add_action customize_register not working

You always need to be sure that three things are defined (section, setting and control).

If you are adding a control to an already defined section, i.e. title_tagline, then you don’t need to re-register it, but always define the setting and the control.

//adding setting for copyright text
add_action('customize_register', 'theme_copyright_customizer');

function theme_copyright_customizer($wp_customize) {
    //adding section in wordpress customizer   
    $wp_customize->add_section('copyright_extras_section', array(
        'title'          => 'Copyright Text Section'
    ));

    //adding setting for copyright text
    $wp_customize->add_setting('text_setting', array(
        'default'        => 'Default Text For copyright Section',
    ));

    $wp_customize->add_control('text_setting', array(
        'label'   => 'Copyright text',
        'section' => 'copyright_extras_section',
        'type'    => 'text',
    ));
}

Hope it helps!

Leave a Comment

error code: 523