Support » Plugin: PB Responsive Images » wp_register_script was called incorrectly

  • Resolved jloft

    (@jloft)


    I just installed and activated PB Responsive Images in WP 3.5.1 with the TwentyTwelve theme. The top of the wp-admin screen displays the following error message:

    Notice: wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /path-to-domain/wp-includes/functions.php on line 2959

    In addition, on the plugin’s setting page, there is an error message under each format row:

    Notice: Undefined property: stdClass::$fallback in /path-to-domain/wp-content/plugins/pb-responsive-images/config-page.php on line 125

    Clicking the “restore defaults” or “save changes” buttons results in a “Cannot modify headers information – headers already sent…” warning.

    http://wordpress.org/extend/plugins/pb-responsive-images/

Viewing 10 replies - 1 through 10 (of 10 total)
  • I see now that the plugin is designated as only compatible up to 3.4.2. Perhaps that’s why I’m experiencing these errors.

    Is the plugin still in active development? Will it be compatible with 3.5.1, 3.6, etc. in the future?

    Plugin Author Jacob Dunn

    (@spacemanspud)

    Sure – it’s in active development, I just haven’t had time to push any updates lately. I’ve got a couple of other features in the works, just need to test them across environments.

    As to your error – I haven’t seen that before. When I have a moment tonight I’ll see if I can reproduce it with the latest version of WordPress.

    Thank you. I appreciate your help.

    I just started over with a fresh WP install. Installing and activating PB Responsive did not result in the error messages this time. Not sure what the difference is between the two installs, but clearly, it is not a consistent error.

    Plugin Author Jacob Dunn

    (@spacemanspud)

    I updated to the latest version of WordPress locally, and am seeing no errors as of yet.

    Were there any other plugins installed on the previous iteration? There may have been a conflict. The other cause is you may have been running WordPress in debug mode – I’ll test in that here shortly to confirm.

    However, all of that aside – I’m changing the call location of wp_register_script to suppress that notice, should that have been the cause of the issues. Once I’m done testing the rest of my changes, I’ll push an update this weekend at some point.

    Good call. It was the debug mode. I often develop with debugging set to true. The error notices are just minor annoyances for the most part, but the “header already sent” warning is a bigger problem because it results in a white screen and does not save changes to the settings. Thus, plugin settings cannot be edited and saved with debug mode active.

    Plugin Author Jacob Dunn

    (@spacemanspud)

    Cool. I’ll pull the latest build into debug mode and see if I can take care of those issues. Thanks for the heads up!

    Hi guys,

    Any news on the bug? I have the problem too in debug mode.

    Thanks in advance

    Plugin Author Jacob Dunn

    (@spacemanspud)

    K gents,

    I’ve released a new version of the plugin that should resolve all the issues with debug mode. Let me know if 1.4 doesn’t do it.

    Enjoy!

    I found a solution for this problem, post here so if others developers may need it in the future.

    In my case, the problem was I call the wp_register_script directly. The solution is to group it into a function

    function load_scripts()
    {
        wp_register_script(...);
        wp_register_script(...);
    }

    then:

    add_action('admin_init', 'load_scripts');

    Then the problem went away.

    Hope that helps.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘wp_register_script was called incorrectly’ is closed to new replies.