I’ve got the notice:
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 /wp-includes/functions.php on line 5313
With further inspection I came to realize your call to the
wp_localize_scriptfunction is using a string (‘loader’) as the third argument, but it should be an array, as the documentation says:
wp_localize_script( string $handle, string $object_name, array $l10n )
A quick fix would be to just wrap the $_mff value into  and you should be done.
Thank you very much.
- The topic ‘Fix the wp_localize_script call’ is closed to new replies.