Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created a custom control for the theme customizer which is a simple button and label. I am going to be using it as a theme reset button that will clear the theme mod settings to their original state. Now that I have added the control and have it showing up on the customizer, I am not sure where I am supposed to add the code to reset the settings.

So far I have only created customizer settings for css and text changes. To remove the settings I will be using the remove theme mods function.

<?php remove_theme_mods() ?>

So my question is do I need to add this to the actual controls code(seen below) or do I need to create a seperate function for this and somehow bind it? if so how exactly do I do that.

function newtheme_customize_reset_control($wp_customize) {
     * Reset Control
    class newtheme_Customize_reset_Control extends WP_Customize_Control {
        public $type = 'button';

        public function render_content() {
                        <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
                                    <a href="#" class="button-secondary upload"><?php _e( 'Reset Settings' ); ?></a>

add_action( 'customize_register', 'newtheme_customize_reset_control', 1, 1 );
share|improve this question
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.