OpenSanghaFoundation / OSF

Bug/Feature requests tracking and documentation managament
https://opensanghafoundation.org
0 stars 0 forks source link

Function WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. #10

Closed coiby closed 4 months ago

coiby commented 7 months ago

With define( 'WP_DEBUG', true ); in wp-config.php, the following message will be shown,

Notice: Function 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 /var/www/html/wp-includes/functions.php on line 6031

coiby commented 7 months ago

According to https://wordpress.org/support/topic/wp-5-7-notice-wp_scriptslocalize-was-called-incorrectly/, there could be one plugin not calling wp_localize_script with the last parameter as an array. And I can confirm after disabling all plugins, this message will be gone. So this message can be safely ignored and it'll be gone after we turn off WP_DEBUG. Besides, if we keep the plugins up-to-date, this message may be gone even with WP_DEBUG turned on.

OSFOSF commented 4 months ago

have not seen this message in a long time so lets close it