• Resolved ebai4

    (@ebai4)


    With the latest WP 6.2 I’m getting this notice:

    plugins\wpvr\admin\class-wpvr-admin.php:243

    [03-Apr-2023 09:47:06 UTC] PHP Notice: ?Function WP_Scripts::localize was called <strong>incorrectly</strong>. The <code>$l10n</code> parameter must be an array. To pass arbitrary data to scripts, use the <code>wp_add_inline_script()</code> function instead. Please see <a href="https://www.ads-software.com/documentation/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 5.7.0.) in xxxxxxxx\wp-includes\functions.php on line 5865
    
    [03-Apr-2023 09:47:06 UTC] PHP Stack trace:
    
    [03-Apr-2023 09:47:06 UTC] PHP ? 1. {main}() xxxxxxxx\wp-admin\admin.php:0
    
    [03-Apr-2023 09:47:06 UTC] PHP ? 2. require_once() xxxxxxxx\wp-admin\admin.php:239
    
    [03-Apr-2023 09:47:06 UTC] PHP ? 3. do_action() xxxxxxxx\wp-admin\admin-header.php:118
    
    [03-Apr-2023 09:47:06 UTC] PHP ? 4. WP_Hook->do_action() xxxxxxxx\wp-includes\plugin.php:517
    
    [03-Apr-2023 09:47:06 UTC] PHP ? 5. WP_Hook->apply_filters() xxxxxxxx\wp-includes\class-wp-hook.php:332
    
    [03-Apr-2023 09:47:06 UTC] PHP ? 6. Wpvr_Admin->enqueue_scripts() xxxxxxxx\wp-includes\class-wp-hook.php:308
    
    [03-Apr-2023 09:47:06 UTC] PHP ? 7. wp_localize_script() xxxxxxxx\wp-content\plugins\wpvr\admin\class-wpvr-admin.php:243
    
    [03-Apr-2023 09:47:06 UTC] PHP ? 8. WP_Scripts->localize() xxxxxxxx\wp-includes\functions.wp-scripts.php:221
    
    [03-Apr-2023 09:47:06 UTC] PHP ? 9. _doing_it_wrong() xxxxxxxx\wp-includes\class-wp-scripts.php:502
    
    [03-Apr-2023 09:47:06 UTC] PHP ?10. trigger_error() xxxxxxxx\wp-includes\functions.php:5865
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @ebai4 ,

    Thank you for informing us about it.

    We’re forwarding this to our developers to have a look.

    Thank you for your patience.

    Regards,

    Hi @ebai4 ,

    We tried it on multiple testing sites on our end but couldn’t replicate the issue.

    Can you please make sure that WPVR is updated to the latest version?

    And then run a plugin conflict test to see if it’s due to a conflict with any other plugin.

    You can also contact us on our site.

    Regards,

    I had the same error. Problem was in class-wpvr-admin.php

    I have replaced this:

    wp_localize_script(
    	$this->plugin_name,
    	'admin_url',
    	admin_url()
    );

    with this:

    wp_localize_script(
    	$this->plugin_name,
    	'admin_url',
    	array('admin_url()')
    );

    And error message is gone. What do you think about this solution Jahir?

    • This reply was modified 1 year, 11 months ago by darkoth.
    • This reply was modified 1 year, 11 months ago by darkoth.

    Hi @darkoth ,

    Thank you so much for your input.

    I’m forwarding it to our devs. I’ll let you know as soon as I hear something from them.

    Regards,

    Hi @ebai4 & @darkoth ,

    Thank you for your patience.

    We’ve just released an update of the plugin with a fix to this issue.

    Please update your plugin to the latest version and see if it’s resolved.

    Let us know if the issue is still there.

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Function WP_Scripts::localize was called incorrectly’ is closed to new replies.