[wp-trac] [WordPress Trac] #37443: locate_template() fails when called in API context

WordPress Trac noreply at wordpress.org
Fri Aug 5 03:07:55 UTC 2016


#37443: locate_template() fails when called in API context
-----------------------------------------+------------------------------
 Reporter:  paulschreiber                |       Owner:
     Type:  defect (bug)                 |      Status:  reopened
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Themes                       |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |     Focuses:  template
-----------------------------------------+------------------------------

Comment (by paulschreiber):

 John, Here's what Derrick Tennant at Automattic told me in a WordPress VIP
 support ticket (55413):

   This is because the function uses the constants STYLESHEETPATH and
 TEMPLATEPATH which were already defined (to a generic "public API"
 context) earlier than the VIP theme is loaded.

 We had a similar problem with oEmbed content. In VIP ticket 38013, Nick
 Daugherty wrote:

   In the context of the oEmbed api endpoint, the WP constants
 STYLESHEETPATH and STYLESHEETPATH will be set to a site other than
 FiveThirtyEight, as that's not the site loaded during an API call.
   This means that the function locate_template() (and anything else that
 relies on those constants) does not work as expected. For FiveThrityEight,
 this means the 'burrito bracket' shortcode will not render correctly in
 the oEmbed context, as it does things like this:

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


More information about the wp-trac mailing list