致命错误(在非对象上调用成员函数check_capabilities())

我已经在functions.php中编写了此代码, 以在主题个性化设置中添加一个部分。但是, 当我想打开” localhost / wordpress / wp-admin / customize.php?theme = eye-theme” 查看结果时, 我看到此错误:

致命错误:在第233行的C:\ xampp \ htdocs \ xampp \ wordpress \ wp-includes \ class-wp-customize-control.php中的非对象上调用成员函数check_capabilities()
这是我的functions.php:
< ?phpfunction eyetheme_register_theme_customizer($wp_customizer) {$wp_customizer-> add_section( 'eyetheme_display_options', array( 'title'=> 'Display Options', 'priority'=> 200 ) ); $wp_customizer-> add_setting( 'eyetheme_link_color', array( 'default'=> '#000000', 'transport' => 'postMessage' ) ); $wp_customizer-> add_control( 'eyetheme_link_control', array( 'section'=> 'eyetheme_display_options', 'label'=> 'Link Color', 'type'=> 'text' ) ); } add_action('customize_register', 'eyetheme_register_theme_customizer');

#1你需要在$ wp_customizer-> add_control()的参数中更新$ wp_customizer-> add_setting()方法和” settings” 参数。
即在你的示例中,
$wp_customizer-> add_setting( 'link_color', array( 'default'=> '#000', 'transport' => 'postMessage' ) ); $wp_customizer-> add_control( 'eyetheme_link_control', array( 'section'=> 'eyetheme_display_options', 'label'=> 'Link Color', 'type'=> 'text', 'settings'=> 'link_color' ) )

【致命错误(在非对象上调用成员函数check_capabilities())】试试这个代码…

    推荐阅读