[wp-trac] [WordPress Trac] #18298: deprecate TEMPLATEPATH and STYLESHEETPATH

WordPress Trac noreply at wordpress.org
Fri May 27 21:15:36 UTC 2022


#18298: deprecate TEMPLATEPATH and STYLESHEETPATH
---------------------------+-----------------------------
 Reporter:  aaroncampbell  |       Owner:  wonderboymusic
     Type:  enhancement    |      Status:  reopened
 Priority:  normal         |   Milestone:  Future Release
Component:  Themes         |     Version:  3.0
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:  template
---------------------------+-----------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:40 sebastienserre]:
 > We should maybe just check if constant are defined ?

 They are defined via `wp_templating_constants()` early in `wp-
 settings.php`, so it seems like the only way to get these warnings is to
 call `is_child_theme()` too early: directly on file inclusion or on one of
 the following actions:

 * `plugins_loaded`
 * `sanitize_comment_cookies`
 * `setup_theme`

 I suppose `is_child_theme()` could check if `TEMPLATEPATH` and
 `STYLESHEETPATH` are defined, and return `false` otherwise, but that might
 not be the expected result if a child theme is indeed in use, it's just
 that the check is performed too early. Perhaps a `_doing_it_wrong()`
 message would be a better option, similar to the one we have for
 conditional tags:
 {{{
 if ( ! isset( $wp_query ) ) {
         _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not
 work before the query is run. Before then, they always return false.' ),
 '3.1.0' );
         return false;
 }
 }}}

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


More information about the wp-trac mailing list