[wp-trac] [WordPress Trac] #65070: Move inline JS from admin_head hooks in options screens into options.js

WordPress Trac noreply at wordpress.org
Tue Apr 14 12:58:14 UTC 2026


#65070: Move inline JS from admin_head hooks in options screens into options.js
----------------------------+-----------------------------------------
 Reporter:  anukasha        |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:  javascript, administration
----------------------------+-----------------------------------------
Changes (by wpdevsxyz):

 * keywords:  needs-patch => has-patch
 * focuses:   => javascript, administration


Comment:

 This patch moves the three inline <script> blocks from admin_head hooks
 into
 a new enqueued file: src/js/_enqueues/admin/options.js.

 Changes:
 - Created src/js/_enqueues/admin/options.js with all three JS blocks
 combined
 - Registered 'options' script handle in script-loader.php (jquery
 dependency, footer)
 - options-general.php: wp_enqueue_script('options') + wp_localize_script()
 to pass homeURL
 - options-discussion.php: wp_enqueue_script('options')
 - options-reading.php: wp_enqueue_script('options')
 - Deprecated options_discussion_add_js(), options_general_add_js(),
 options_reading_add_js() in 7.1.0

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


More information about the wp-trac mailing list