[wp-trac] [WordPress Trac] #58664: Eliminate manual construction of script tags in WP_Scripts

WordPress Trac noreply at wordpress.org
Tue Sep 5 18:06:16 UTC 2023


#58664: Eliminate manual construction of script tags in WP_Scripts
--------------------------------------+--------------------------
 Reporter:  westonruter               |       Owner:  westonruter
     Type:  defect (bug)              |      Status:  accepted
 Priority:  normal                    |   Milestone:  6.4
Component:  Script Loader             |     Version:  6.3
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  javascript
--------------------------------------+--------------------------

Comment (by westonruter):

 For a discussion about the use of output buffering to ensure IDE
 intelligence for inline script tags with `wp_print_inline_script_tag()`
 extended to support passing a closure, see
 [https://wordpress.slack.com/archives/C5UNMSU4R/p1693591315595499 thread
 in #core-js]. For example:

 {{{#!php
 <?php
 wp_print_inline_script_tag(
         static function () {
                 ?>
                 <script>
                         var foo = 'bar';
                         /* JS code goes here */
                 </script>
                 <?php
         }
 );
 );
 }}}

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


More information about the wp-trac mailing list