Fatal error: Calling member function check_capabilities () on non-object
I wrote this code in functions.php to add a section to my theme personalization. But when I want to open "localhost / wordpress / wp-admin / customize.php? Theme = eye-theme" to see my result, I see this error:
Fatal error: Calling member function
check_capabilities()
for non-object in C: \ xampp \ htdocs \ xampp \ wordpress \ wp-includes \ class-wp-customize-control.php on line 233
This is my functions.php :
<?php
function 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');
+3
source to share
1 answer
You need to update the $ wp_customizer-> add_setting () parameter and the "settings" parameter in the arguments for $ wp_customizer-> add_control ().
i.e. In your example
$ 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' ) )
Try this code ...
+9
source to share