[wp-trac] [WordPress Trac] #39211: is_page_template could return true on terms

WordPress Trac noreply at wordpress.org
Sat Dec 10 17:37:49 UTC 2016


#39211: is_page_template could return true on terms
----------------------------------------+-------------------------
 Reporter:  natereist                   |       Owner:  swissspidy
     Type:  defect (bug)                |      Status:  assigned
 Priority:  normal                      |   Milestone:  4.7.1
Component:  Posts, Post Types           |     Version:  4.7
 Severity:  normal                      |  Resolution:
 Keywords:  needs-unit-tests has-patch  |     Focuses:  template
----------------------------------------+-------------------------

Comment (by dlh):

 [attachment:39211.2.patch] includes a test that creates an ID shared
 between a term and a post assigned a template, and checks
 `is_page_template()` after visiting the term.

 I also included a related change to `Tests_Query_Conditionals` and
 `Tests_Query_VerbosePageRules`. Their `setUp()` methods currently call
 `set_permalink_structure()` before `create_initial_taxonomies()`, such
 that the initial taxonomies won't have added their permastructs before the
 first test runs. The patch would flip the order of those calls.

 You should be able to see the effect of the current order by running just
 `test_is_page_template_not_singular()` without applying the change to the
 two `setUp()` methods. At least for me, `go_to( get_term_link() )` fails
 during `Tests_Query_Conditionals`, so the `assertInstanceOf()` also fails.
 Everything passes the second time through with
 `Tests_Query_VerbosePageRules`.

 If the change to `setUp()` isn't going to work, then I can find another
 approach for the new test.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39211#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list