remove_theme_mod example


    public $id = 'background_image_thumb';

    /** * @since 3.4.0 * * @param mixed $value The value to update. Not used. */
    public function update( $value ) {
        remove_theme_mod( 'background_image_thumb' );
    }
}
if ( ! empty( $nav_menu_locations ) && empty( $default_theme_mods['nav_menu_locations'] ) ) {
            $default_theme_mods['nav_menu_locations'] = $nav_menu_locations;
        }
        add_option( "theme_mods_$stylesheet", $default_theme_mods );
    } else {
        /* * Since retrieve_widgets() is called when initializing a theme in the Customizer, * we need to remove the theme mods to avoid overwriting changes made via * the Customizer when accessing wp-admin/widgets.php. */
        if ( 'wp_ajax_customize_save' === current_action() ) {
            remove_theme_mod( 'sidebars_widgets' );
        }
    }

    // Stores classic sidebars for later use by block themes.     if ( $new_theme->is_block_theme() ) {
        set_theme_mod( 'wp_classic_sidebars', $wp_registered_sidebars );
    }

    update_option( 'theme_switched', $old_theme->get_stylesheet() );

    /** * Fires after the theme is switched. * * See {@see 'after_switch_theme'}. * * @since 1.5.0 * @since 4.5.0 Introduced the `$old_theme` parameter. * * @param string $new_name Name of the new theme. * @param WP_Theme $new_theme WP_Theme instance of the new theme. * @param WP_Theme $old_theme WP_Theme instance of the old theme. */

    public function take_action() {
        if ( empty( $_POST ) ) {
            return;
        }

        if ( isset( $_POST['reset-background'] ) ) {
            check_admin_referer( 'custom-background-reset', '_wpnonce-custom-background-reset' );

            remove_theme_mod( 'background_image' );
            remove_theme_mod( 'background_image_thumb' );

            $this->updated = true;
            return;
        }

        if ( isset( $_POST['remove-background'] ) ) {
            // @todo Uploaded files are not removed here.             check_admin_referer( 'custom-background-remove', '_wpnonce-custom-background-remove' );

            set_theme_mod( 'background_image', '' );
            
update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() );

            set_theme_mod( 'header_image', $choice['url'] );
            set_theme_mod( 'header_image_data', $header_image_data );

            return;
        }

        if ( in_array( $choice, array( 'remove-header', 'random-default-image', 'random-uploaded-image' ), true ) ) {
            set_theme_mod( 'header_image', $choice );
            remove_theme_mod( 'header_image_data' );

            return;
        }

        $uploaded = get_uploaded_header_images();

        if ( $uploaded && isset( $uploaded[ $choice ] ) ) {
            $header_image_data = $uploaded[ $choice ];
        } else {
            $this->process_default_headers();
            if ( isset( $this->default_headers[ $choice ] ) ) {
                

function _delete_custom_logo_on_remove_site_logo() {
    global $_ignore_site_logo_changes;

    // Prevent _delete_site_logo_on_remove_custom_logo and     // _delete_site_logo_on_remove_theme_mods from firing and causing an     // infinite loop.     $_ignore_site_logo_changes = true;

    // Remove the custom logo.     remove_theme_mod( 'custom_logo' );

    $_ignore_site_logo_changes = false;
}
add_action( 'delete_option_site_logo', '_delete_custom_logo_on_remove_site_logo' );
Home | Imprint | This part of the site doesn't use cookies.