Question

I'm trying to migrate a wordpress site, and i'm receiving this error when debugging on the new server:

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

Line 3049 looks like this (the one beginning with trigger_error)

function _doing_it_wrong( $function, $message, $version ) {

do_action( 'doing_it_wrong_run', $function, $message, $version );

// Allow plugin to filter the output error trigger
if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) {
    if ( function_exists( '__' ) ) {
        $version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );
        $message .= ' ' . __( 'Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.' );
        trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) );
    } else {
        $version = is_null( $version ) ? '' : sprintf( '(This message was added in version %s.)', $version );
        $message .= ' Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.';
        trigger_error( sprintf( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version ) );
    }
}

}

However, I can't see any use of wp_register_script in the functions.php, so i'm confused by what's causing this. Any ideas?

No correct solution

OTHER TIPS

The file / line it's telling you to look in is incorrect.

I'd start by disabling all your plugins and seeing if the error persists.

More likely however is the issue being inside a theme file. If disabling all the plugins doesn't resolve the error switch your theme to test.

You're seeing this issue on the new host because of a difference in error reporting. The issue will have been present on the old host but not shown to you.

Anyway let me know the results of the tests above and I'll adjust my answer accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top