wordpress Call to a member function add_section() on a non-object in functions.php line 5 wordpress Call to a member function add_section() on a non-object in functions.php line 5 wordpress wordpress

wordpress Call to a member function add_section() on a non-object in functions.php line 5


You're missing the $wp_customize argument. And, if I'm not mistaken, it might be an idea to use a different name for add_setting and add_control. See the code below.

function sandor_hero_cap($wp_customize) {    $wp_customize->add_section('sandor_subhead_title', array(    'title' => __('Sub-Header', 'sandor'),));    $wp_customize->add_setting('sandor_playground', array(    'default' => 'A Virtual PLAYGROUND',    'capability' => 'edit_theme_options',    'sanitize_callback' => 'sanitize_text_field'));$wp_customize->add_control('sandor_playground', array(    'label' => __('Sub-Header Title', 'sandor'),    'section' => 'sandor_subhead_section',    'priority' => 5,    'settings' => 'sandor_subhead_title'));}add_action( 'customize_register', 'sandor_hero_cap' );