[wp-trac] [WordPress Trac] #65398: htmlhint.js started linting correctly with 7.0 in Admin, exposing plugin code incorrectly calling it on non-plugin pages (was: calling wp_enqueue_code_editor() inside wp_localize_script() triggers the script since v7.0)

WordPress Trac noreply at wordpress.org
Thu Jun 4 19:11:55 UTC 2026


#65398: htmlhint.js started linting correctly with 7.0 in Admin, exposing plugin
code incorrectly calling it on non-plugin pages
--------------------------+----------------------
 Reporter:  terraGirl     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Themes        |     Version:  7.0
 Severity:  minor         |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------

Comment (by terraGirl):

 Resolved:

 The behaviour to load `htmlhint.js` when `wp_enqueue_code_editor()` is
 called inside `wp_localize_script()` is correct.

 However, before 7.0, the linting was broken, and the loaded file was not
 detected. With 7.0, linting started working and exposed the incorrect code
 in the plugin.

 6.9 loads wp-includes/js/codemirror/htmlhint.js?ver=0.9.14-xwp
 7.0 loads wp-includes/js/codemirror/htmlhint.js?ver=1.8.0

 Solution: update the plugin to guard wp_localize_script() against being
 called on every admin page.

 An interesting case of a fix in WP Core exposing a previous silent bug in
 a plugin.

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


More information about the wp-trac mailing list