I've created a custom customizer section for my client to set their contact phone number by using this snippet:
function header_ctas ( $wp_customize ) {
$wp_customize->add_section( 'cta_section' , array(
'title' => 'Call to action buttons',
'description' => 'Configure the cta buttons in here for mobile screen',
'priority' => 30,
) );
$wp_customize->add_setting( 'cta_settings' );
$wp_customize->add_control( 'phone_control' , array(
'label' => 'Phone number',
'description' => 'enter the phone number here, it will appear in mobile screen',
'section' => 'cta_section',
'settings' => 'cta_settings',
'type' => 'text',
) );
}
add_action( 'customize_register', 'header_ctas' );
I can retrieve the value of the phone number by get_theme_mod('cta_settings')
.
After that, I want to properly name the settings, so I just change the cta_settings
to phone_settings
, and when I try to retrieve the value by get_theme_mod('phone_settings')
, it returns nothings. It turns out that the real setting name is still the cta_settings
, and after I delete the whole function, the value is still there.
I also tried to use
$wp_customize->remove_control("phone_control");
and
$wp_customize->remove_section( 'cta_section' );
, it basically removes the section and it doesn't remove the value.
I also tried to find out how to deregister the custom theme customizer and to find where the value is in database but no luck :(
Can anyone point me a right direction to dig deeper? Thanks.