WP迁移时出现wp_register_script错误

时间:2014-03-04 02:59:40

标签: wordpress migration

我正在尝试迁移wordpress网站,并且在新服务器上调试时我收到此错误:

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

第3049行看起来像这样(以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 ) );
    }
}

}

但是,我在functions.php中看不到任何wp_register_script的使用,所以我对导致这种情况的原因感到困惑。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

它告诉你查看的文件/行是不正确的。

我首先要禁用所有插件并查看错误是否仍然存在。

然而,更有可能的问题是在主题文件中。如果禁用所有插件无法解决错误,请切换主题以进行测试。

由于错误报告存在差异,您在新主机上看到此问题。该问题将出现在旧主机上,但未向您显示。

无论如何,让我知道上面测试的结果,我会相应地调整我的答案。