【问题标题】:wordpress customize control panel doesn't work after offline migration离线迁移后wordpress自定义控制面板不起作用
【发布时间】:2018-11-09 12:11:50
【问题描述】:

我最近通过插件 All-in-One WP Migration 将离线 wordpress 自定义 Web 模板迁移到在线服务器。一切正常,除了自定义控制面板。调试日志中有致命错误:

[09-Nov-2018 11:56:41 UTC] PHP Fatal error:  Uncaught Error: Class 'WP_Customize_Code_Editor_Control' not found in /wp-includes/class-wp-customize-manager.php:5317

Stack trace:
#0 wp-includes/class-wp-hook.php(286): WP_Customize_Manager->register_controls(Object(WP_Customize_Manager))
#1 wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#2 wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#3 wp-includes/class-wp-customize-manager.php(926): do_action('customize_regis...', Object(WP_Customize_Manager))
#4 wp-includes/class-wp-hook.php(286): WP_Customize_Manager->wp_loaded('')
#5 wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#6 wp-includes/class-wp-customize-manager.php on line 5317

我尝试了一些类似 .htaccess 的问题,增加上传内存,停用所有插件或用原始 wp 安装文件覆盖 class-wp-customize-manager.php。

没有任何效果。

有什么想法吗?非常感谢。

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    您必须在绑定到“customize_register”操作的函数中定义自定义函数类,因为只有在实际使用主题定制器时才会加载类 WP_Customize_Control。 示例代码:

    add_action( 'customize_register', 'my_customize_register' );
    function my_customize_register($wp_customize) {
       //class definition must be within my_customie_register function
       class your_customize_fuction extends WP_Customize_Control { ... }
    }
    

    【讨论】:

    • 非常感谢您的帮助。真的很欣赏它。抱歉有点无知,但老实说我不知道​​,我应该怎么做才知道(PHP中的菜鸟)。是否可以逐步告诉我什么代码,放在哪里以及修复它的其他步骤?如果您需要更多我的代码,请询问。
    猜你喜欢
    • 2014-04-10
    • 1970-01-01
    • 2015-09-22
    • 1970-01-01
    • 1970-01-01
    • 2013-11-10
    • 1970-01-01
    • 1970-01-01
    • 2017-07-07
    相关资源
    最近更新 更多