WordPress.org

Ready to get started?Download WordPress

Forums

PB Responsive Images
[resolved] wp_register_script was called incorrectly (11 posts)

  1. jloft
    Member
    Posted 1 year ago #

    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/

  2. jloft
    Member
    Posted 1 year ago #

    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?

  3. Jacob Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  4. jloft
    Member
    Posted 1 year ago #

    Thank you. I appreciate your help.

  5. jloft
    Member
    Posted 1 year ago #

    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.

  6. Jacob Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  7. jloft
    Member
    Posted 1 year ago #

    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.

  8. Jacob Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    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!

  9. codingpuss
    Member
    Posted 1 year ago #

    Hi guys,

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

    Thanks in advance

  10. Jacob Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    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!

  11. codingpuss
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.