[wp-meta] [Making WordPress.org] #5200: Update wp_register_script documentation to recommend registration on init instead of wp_enqueue_scripts

Making WordPress.org noreply at wordpress.org
Tue May 5 18:36:44 UTC 2020


#5200: Update wp_register_script documentation to recommend registration on init
instead of wp_enqueue_scripts
-------------------------+---------------------
 Reporter:  jhned        |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  low          |   Milestone:
Component:  Codex        |  Resolution:
 Keywords:               |
-------------------------+---------------------

Comment (by Otto42):

 The init action happens before the *_enqueue_scripts hooks, so you will
 not get a "comprehensive" list at that point in time. Any scripts that are
 enqueue-ing on the recommended hooks will not be registered or listed at
 the init hook time.

 The reason for waiting until *_enqueue_scripts is that it is the last
 point in the process when a script can be added before wp_print_scripts
 outputs them (in the header). Waiting until the last possible moment has
 the advantage of having everything relevant probably loaded by that point.

-- 
Ticket URL: <https://meta.trac.wordpress.org/ticket/5200#comment:1>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list