This error is popping up 5 times on the top of my dashboard saying:

Notice: WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.) in /home/myservername/public_html/mysite.com/wp-includes/functions.php on line 5313

What is the issue and how can I fix it?

  • 1
    At a guess, you have a plugin or theme with a bug in it. That or you added something to functions.php which needs a review. Try disabling plugins until the error stops. Then one by one re-enable them. When the errors come back, the last activated plugin was probably the culprit. Mar 10, 2021 at 2:35
  • 1
    Localizing scripts was intended for multi-lingual usage, to allow people to add translations for plugins and themes, but at some point someone figured out you could use it to pass dynamically generated variables to your scripts - WordPress made a change a while ago to get people to use localize properly and so they added wp_add_inline_script() as an alternative solution to pass variables to scripts. This isn't actually an error but rather a notice from WP that the method is being used incorrectly. If you're seeing it, it's because you have DEBUG enabled in your wp-config.php. Mar 10, 2021 at 4:19

1 Answer 1


You have a plugin or theme that is using wp_localize_script() incorrectly. That's all that can be said based on what you've shared. The solution is to deactivate plugins until the error goes away. The last plugin you deactivated is responsible, and you will need to contact its author about properly supporting 5.7.

Note that apart from this message, this shouldn't be causing any other issues on your site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.