WordPress.org

Ready to get started?Download WordPress

Forums

Network Latest Posts
[resolved] PHP debug notice (3 posts)

  1. ihavetoomany
    Member
    Posted 1 year ago #

    Someting makes my WP throw this message when I turn on debug mode:

    Notice: wp_register_style 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.).../wp-includes/functions.php on line 2758

    Notice: wp_enqueue_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 .../wp-includes/functions.php on line 2758

    If deactivate your plug it goes away...

    The plughin works fine thou...I just wanted you to know...

    http://wordpress.org/extend/plugins/network-latest-posts/

  2. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 1 year ago #

    Hello, thanks for your feedback. I was already aware of this because someone had notified me about it some days ago by email. I'm a little bit busy so I couldn't release a fix before. v3.1.4 should fix this.

    In case someone is wondering how to fix this notice it's actually pretty simple though.. WordPress is really careful with its loading hook hierarchy, NLPosts register styles to handle default or customized css files within the init function but also inside some other functions.

    If we call this hook before wp_enqueue_scripts, admin_enqueue_scripts or init you get this kind of Notice.

    NLPosts was being initialized using:

    add_action("plugins_loaded","network_latest_posts_init");

    I changed it by this:

    add_action("wp_enqueue_scripts","network_latest_posts_init");

    That's it,
    Cheers.

  3. ihavetoomany
    Member
    Posted 1 year ago #

    ...awsome...and a 5 star rating for you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.