WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#39413 closed defect (bug) (duplicate)

Problem with WP 4.7 and "is_page_template" function

Reported by: mekshq Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: General Keywords:
Focuses: Cc:

Description

Hi,

I have found a strange bug in the recent WP 4.7 version which is probably related to new feature that allows templates for all post types.

Here is the info:

You have some page template, for example template-example.php and you assign a page to it. Then, if any taxonomy (category, tag, or any custom) uses the same ID as that page, when is_page_template('template-example.php') is called on taxonomy template it will always return true. I guess the problem should be easily fixed if you just add a conditional statement is_singular() within is_page_template function.

Hope this is clear enough.

Cheers!

Change History (2)

#1 follow-up: @ocean90
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hello @mekshq, welcome to WordPress Trac!

Thanks for your valid report. It's a duplicate of #39211, though, which is already fixed in the 4.7 branch and will be available in the next minor release.
If you'd like to test out the upcoming 4.7.1 release on your site before the release, it includes a fix for this and bunch of other issues, see the directions available here for installing the beta testing plugin.

#2 in reply to: ↑ 1 @mekshq
3 years ago

All right, thanks for letting us know. Glad this is fixed already!

Cheers!

Replying to ocean90:

Hello @mekshq, welcome to WordPress Trac!

Thanks for your valid report. It's a duplicate of #39211, though, which is already fixed in the 4.7 branch and will be available in the next minor release.
If you'd like to test out the upcoming 4.7.1 release on your site before the release, it includes a fix for this and bunch of other issues, see the directions available here for installing the beta testing plugin.

Note: See TracTickets for help on using tickets.