esc_html__( 'Reset', 'acumen' ), 'confirm' => esc_html__( "Caution! This action is irreversible. Press OK to continue.", 'acumen' ), 'nonce' => array( 'reset' => wp_create_nonce( 'acumen-customizer-reset' ), ), 'resetSection' => esc_html__( 'Reset Section', 'acumen' ), 'confirmSection' => esc_html__( "Caution! This action is irreversible. Press OK to reset the section.", 'acumen' ), ) ); } /** * Store a reference to `WP_Customize_Manager` instance * * @param $wp_customize */ public function customize_register( $wp_customize ) { $this->wp_customize = $wp_customize; } public function ajax_customizer_reset() { if ( ! $this->wp_customize->is_preview() ) { wp_send_json_error( 'not_preview' ); } if ( ! check_ajax_referer( 'acumen-customizer-reset', 'nonce', false ) ) { wp_send_json_error( 'invalid_nonce' ); } if ( isset( $_POST['section'] ) && 'reset-all' === $_POST['section'] ) { // Remove all theme mods. remove_theme_mods(); } wp_send_json_success(); } } } Acumen_Customizer_Reset::get_instance();