[wp-trac] [WordPress Trac] #54958: Inconsistent behaviour for wp_add_inline_script between block-based and standard themes

WordPress Trac noreply at wordpress.org
Fri Jan 28 12:43:43 UTC 2022


#54958: Inconsistent behaviour for wp_add_inline_script between block-based and
standard themes
--------------------------+------------------------------
 Reporter:  Rustaurius    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by sanzeeb3):

 The wp_enqueue_script() and wp_add_inline_script() should not used from
 within the shortcode content.


 The function should be called using the wp_enqueue_scripts action hook if
 you want to call it on the front-end of the site. Calling it outside of an
 action hook can lead to problems like #11526.

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


More information about the wp-trac mailing list