Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp_localize_script $l10n should be a array in wordpress 5.7.0 #35

Closed
LucianoHanna opened this issue Apr 17, 2021 · 2 comments · Fixed by #37
Closed

wp_localize_script $l10n should be a array in wordpress 5.7.0 #35

LucianoHanna opened this issue Apr 17, 2021 · 2 comments · Fixed by #37

Comments

@LucianoHanna
Copy link

There's a warning about wp_localize_script used in code-prettify.php:46, third parameter should be an array

wp_localize_script(
	'code-prettify',
	'codePrettifyLoaderBaseUrl',
	plugins_url( 'prettify', __FILE__ )
); 
rrikesh added a commit to rrikesh/code-prettify that referenced this issue May 11, 2021
Fixes the 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.

This notice appears as from WordPress 5.7.0
@cgarofalo
Copy link

Any updates on this issue?

@kasparsd
Copy link
Owner

kasparsd commented Nov 8, 2021

This has been fixed in version 1.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants