• Resolved efc

    (@eceleste)


    Installing Zotpress on a site with WP_DEBUG enabled results in the following notice:

    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 login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in [redacted]/public_html/wp/wp-includes/functions.php on line 3247

    This is just a warning, but it looks like something that would be good to fix.

    https://wordpress.org/plugins/zotpress/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter efc

    (@eceleste)

    Taking a closer look I find the following two changes resolve WP_DEBUG warnings. Someone with deeper knowledge of the plugin should verify these and commit them to the plugin source.

    Fixing script enqueuing… on line 253 of zotpress.php…

    if (!isset( $GLOBALS['wp_scripts']->registered[ "jquery" ] )) wp_enqueue_script("jquery");

    …replace with…

    function Zotpress_enqueue_scripts() { if (!isset( $GLOBALS['wp_scripts']->registered[ "jquery" ] )) wp_enqueue_script("jquery"); } add_action( 'wp_enqueue_scripts','Zotpress_enqueue_scripts' );

    Dealing with has_cap deprecation… on line 161 of zotpress.php…

    add_menu_page("Zotpress", "Zotpress", 3, "Zotpress", "Zotpress_options", ZOTPRESS_PLUGIN_URL."images/icon.png");

    …replace with…

    add_menu_page("Zotpress", "Zotpress", "edit_posts", "Zotpress", "Zotpress_options", ZOTPRESS_PLUGIN_URL."images/icon.png");

    Once I fixed these, the warnings went away and Zotpress appeared to still function.

    Plugin Author Katie

    (@kseaborn)

    Thanks, eceleste! I’ll add these to the next version.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Zotpress throwing wp-debug notice’ is closed to new replies.