Opened 6 years ago
Closed 6 years ago
#45512 closed defect (bug) (invalid)
After WordPress 5.0 update js_escape is deprecated
Reported by: | adampatterson | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.0 |
Component: | Formatting | Keywords: | |
Focuses: | javascript | Cc: |
Description
After upgrading to WordPress 5.0 locally, I get the following error.
Notice: js_escape is <strong>deprecated</strong> since version 2.8.0! Use esc_js() instead. in /wp-includes/functions.php on line 3861
Looking at the core file I can clearly see that the function is still part of formatting.php where esc_js calls apply_filters on js_escape which is deprecated and recommends that I use esc_js.
I don't know why I haven't experienced this before as it looks like to code hasn't been changed in a long time.
My Plugins are up to date and many of them include esc_js such as Woo Commerce and JetPack.
Change History (4)
Note: See
TracTickets for help on using
tickets.
Hey @adampatterson,
I believe you'll find that one of your up-to-date plugins is calling
escape_js()
. The likely explanation is that it had some 5.0-only functionality built in ready for release, but since you weren't yet on 5.0 it wasn't running that part of the code.esc_js()
calls thejs_escape
filter but doesn't call theescape_js()
function at all.You can use a plugin such as Query Monitor to debug what plugin is calling
js_escape()
and causing the deprecated notice.