[wp-trac] [WordPress Trac] #63806: Bundled themes: Scripts are printed directly without using wp_print_script_tag()/wp_print_inline_script_tag()

WordPress Trac noreply at wordpress.org
Mon Aug 11 04:52:24 UTC 2025


#63806: Bundled themes: Scripts are printed directly without using
wp_print_script_tag()/wp_print_inline_script_tag()
--------------------------------------+-------------------------
 Reporter:  westonruter               |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  6.9
Component:  Bundled Theme             |     Version:  5.7
 Severity:  normal                    |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:  javascript
--------------------------------------+-------------------------

Comment (by westonruter):

 @poena yes, for themes introduced prior to 5.7, the necessary functions
 can shimmed by copying them from core into the themes' `functions.php`
 files. For example, Twenty Twenty has the following:

 {{{#!php
 <?php
 if ( ! function_exists( 'wp_body_open' ) ) {

         /**
          * Shim for wp_body_open, ensuring backward compatibility with
 versions of WordPress older than 5.2.
          *
          * @since Twenty Twenty 1.0
          */
         function wp_body_open() {
                 /**
                  * Triggered after the opening <body> tag.
                  *
                  * @since Twenty Twenty 1.0
                  */
                 do_action( 'wp_body_open' );
         }
 }
 }}}

 Similarly, Twenty Twelve does the following:

 {{{#!php
 <?php
 if ( ! function_exists( 'wp_get_list_item_separator' ) ) :
         /**
          * Retrieves the list item separator based on the locale.
          *
          * Added for backward compatibility to support pre-6.0.0 WordPress
 versions.
          *
          * @since 6.0.0
          */
         function wp_get_list_item_separator() {
                 /* translators: Used between list items, there is a space
 after the comma. */
                 return __( ', ', 'twentytwelve' );
         }
 endif;
 }}}

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


More information about the wp-trac mailing list