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?

  • What you've found is just the code that outputs the error message. You need to look through your themes and plugins for something calling wp_register_script. Disable plugins or switch to the default theme until the error stops appearing, and then you know where the error actually is.
    – Otto
    Commented Mar 4, 2014 at 8:06

1 Answer 1


Apologies if this doesn't solve your problems, however I am unable to add a comment until I reach 50 reputation.


What's causing this issue is what is stated in the notice. There is a theme file/plugin file that is trying to register/enqueue your scripts too soon.


  1. If you have recently updated your theme or functions I would recommend switching to a default theme and disable plugins temporarily to see if this resolves the notice.
  2. If yes, then you can start from the bottom up. Test your theme to see if this is causing the issue, if not proceed to plugins.
  3. Once the notice pops up you will find the cause of the issue.
  4. After you find the cause of the issue you will need to comb the included files for the command wp_register_script(). Then find the location that this function is added to wordpress' hooks. add_action()
  5. Be sure that the function's add_action() argument #1 is something along the lines of wp_enqueue_scripts. See example below.

    function register_my_scripts(){

If this does not solve your issue, or if your issue is not related to your theme files/plugin files the next option is to try a clean update (not install) for WordPress.

Unrelated Note:

Furthermore, if your Domain URL is changing, be sure to update that in WordPress' settings. This is located in Settings -> General. Feel free to ask further questions if I'm in the same atmosphere as your resolution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.