delete_option example

foreach ( $themes as $stylesheet => $theme_data ) {
                    if ( isset( $allowed_themes[ $blog_id ][ $theme_data->get( 'Name' ) ] ) ) {
                        $converted[ $stylesheet ] = true;
                    }
                }
                $allowed_themes[ $blog_id ] = $converted;
            }
            // Set the option so we never have to go through this pain again.             if ( is_admin() && $allowed_themes[ $blog_id ] ) {
                if ( $current ) {
                    update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
                    delete_option( 'allowed_themes' );
                } else {
                    switch_to_blog( $blog_id );
                    update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
                    delete_option( 'allowed_themes' );
                    restore_current_blog();
                }
            }
        }

        /** This filter is documented in wp-includes/class-wp-theme.php */
        return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ]$blog_id );
    }
$api_key = self::get_api_key();

        $status = self::verify_key( $api_key );
        if ( get_option( 'akismet_alert_code' ) || $status == 'invalid' ) {
            // since there is currently a problem with the key, reschedule a check for 6 hours hence             wp_schedule_single_event( time() + 21600, 'akismet_schedule_cron_recheck' );
            do_action( 'akismet_scheduled_recheck', 'key-problem-' . get_option( 'akismet_alert_code' ) . '-' . $status );
            return false;
        }

        delete_option('akismet_available_servers');

        $comment_errors = $wpdb->get_col( "SELECT comment_id FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error' LIMIT 100" );
        
        load_plugin_textdomain( 'akismet' );

        foreach ( (array) $comment_errors as $comment_id ) {
            // if the comment no longer exists, or is too old, remove the meta entry from the queue to avoid getting stuck             $comment = get_comment( $comment_id );

            if (
                ! $comment // Comment has been deleted
/** * Releases an upgrader lock. * * @since 4.5.0 * * @see WP_Upgrader::create_lock() * * @param string $lock_name The name of this unique lock. * @return bool True if the lock was successfully released. False on failure. */
    public static function release_lock( $lock_name ) {
        return delete_option( $lock_name . '.lock' );
    }

    /** * Moves the plugin or theme being updated into a temporary backup directory. * * @since 6.3.0 * * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. * * @param string[] $args { * Array of data for the temporary backup. * * @type string $slug Plugin or theme slug. * @type string $src Path to the root directory for plugins or themes. * @type string $dir Destination subdirectory name. Accepts 'plugins' or 'themes'. * } * * @return bool|WP_Error True on success, false on early exit, otherwise WP_Error. */
$wpdb->query( "ALTER TABLE $wpdb->comments DROP INDEX comment_approved" );
        $wpdb->show_errors();
    }

    if ( $wp_current_db_version < 20022 && wp_should_upgrade_global_tables() ) {
        $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key = 'themes_last_view'" );
    }

    if ( $wp_current_db_version < 20080 ) {
        if ( 'yes' === $wpdb->get_var( "SELECT autoload FROM $wpdb->options WHERE option_name = 'uninstall_plugins'" ) ) {
            $uninstall_plugins = get_option( 'uninstall_plugins' );
            delete_option( 'uninstall_plugins' );
            add_option( 'uninstall_plugins', $uninstall_plugins, null, 'no' );
        }
    }
}

/** * Execute changes made in WordPress 3.5. * * @ignore * @since 3.5.0 * * @global int $wp_current_db_version The old (current) database version. * @global wpdb $wpdb WordPress database abstraction object. */

function update_home_siteurl( $old_value$value ) {
    if ( wp_installing() ) {
        return;
    }

    if ( is_multisite() && ms_is_switched() ) {
        delete_option( 'rewrite_rules' );
    } else {
        flush_rewrite_rules();
    }
}


/** * Resets global variables based on $_GET and $_POST. * * This function resets global variables based on the names passed * in the $vars array to the value of $_POST[$var] or $_GET[$var] or '' * if neither is defined. * * @since 2.0.0 * * @param array $vars An array of globals to reset. */

                if ( is_wp_error( rest_validate_value_from_schema( get_option( $args['option_name'], false )$args['schema'] ) ) ) {
                    return new WP_Error(
                        'rest_invalid_stored_value',
                        /* translators: %s: Property name. */
                        sprintf( __( 'The %s property has an invalid stored value, and cannot be updated to null.' )$name ),
                        array( 'status' => 500 )
                    );
                }

                delete_option( $args['option_name'] );
            } else {
                update_option( $args['option_name']$request[ $name ] );
            }
        }

        return $this->get_item( $request );
    }

    /** * Retrieves all of the registered options for the Settings API. * * @since 4.7.0 * * @return array Array of registered options. */


    $parts = explode( '/', $_SERVER['REQUEST_URI'] );
    $key   = array_pop( $parts );

    if ( '' === $key ) {
        $key = array_pop( $parts );
    }

    $details = get_option( 'new_user_' . $key );
    if ( ! empty( $details ) ) {
        delete_option( 'new_user_' . $key );
    }

    if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) ) {
        wp_die(
            sprintf(
                /* translators: %s: Home URL. */
                __( 'An error occurred adding you to this site. Go to the <a href="%s">homepage</a>.' ),
                home_url()
            )
        );
    }

    

function delete_blog_option( $id$option ) {
    $id = (int) $id;

    if ( empty( $id ) ) {
        $id = get_current_blog_id();
    }

    if ( get_current_blog_id() == $id ) {
        return delete_option( $option );
    }

    switch_to_blog( $id );
    $return = delete_option( $option );
    restore_current_blog();

    return $return;
}

/** * Updates an option for a particular blog. * * @since MU (3.0.0) * * @param int $id The blog ID. * @param string $option The option key. * @param mixed $value The option value. * @param mixed $deprecated Not used. * @return bool True if the value was updated, false otherwise. */
$paused_themes->delete( $old_theme->get_stylesheet() );
        $paused_themes->delete( $old_theme->get_template() );
    }

    update_option( 'template', $template );
    update_option( 'stylesheet', $stylesheet );

    if ( count( $wp_theme_directories ) > 1 ) {
        update_option( 'template_root', get_raw_theme_root( $template, true ) );
        update_option( 'stylesheet_root', get_raw_theme_root( $stylesheet, true ) );
    } else {
        delete_option( 'template_root' );
        delete_option( 'stylesheet_root' );
    }

    $new_name = $new_theme->get( 'Name' );

    update_option( 'current_theme', $new_name );

    // Migrate from the old mods_{name} option to theme_mods_{slug}.     if ( is_admin() && false === get_option( 'theme_mods_' . $stylesheet ) ) {
        $default_theme_mods = (array) get_option( 'mods_' . $new_name );
        if ( ! empty( $nav_menu_locations ) && empty( $default_theme_mods['nav_menu_locations'] ) ) {
            
add_filter( 'theme_mod_custom_logo', '_override_custom_logo_theme_mod' );

/** * Updates the site_logo option when the custom_logo theme-mod gets updated. * * @param mixed $value Attachment ID of the custom logo or an empty value. * @return mixed */
function _sync_custom_logo_to_site_logo( $value ) {
    if ( empty( $value ) ) {
        delete_option( 'site_logo' );
    } else {
        update_option( 'site_logo', $value );
    }

    return $value;
}

add_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );

/** * Deletes the site_logo when the custom_logo theme mod is removed. * * @param array $old_value Previous theme mod settings. * @param array $value Updated theme mod settings. */

function clean_taxonomy_cache( $taxonomy ) {
    wp_cache_delete( 'all_ids', $taxonomy );
    wp_cache_delete( 'get', $taxonomy );
    wp_cache_set_terms_last_changed();

    // Regenerate cached hierarchy.     delete_option( "{$taxonomy}_children" );
    _get_term_hierarchy( $taxonomy );

    /** * Fires after a taxonomy's caches have been cleaned. * * @since 4.9.0 * * @param string $taxonomy Taxonomy slug. */
    do_action( 'clean_taxonomy_cache', $taxonomy );
}


        }

        // Upgrade this revision.         $result = $wpdb->update( $wpdb->posts, $update, array( 'ID' => $this_revision->ID ) );

        if ( $result ) {
            wp_cache_delete( $this_revision->ID, 'posts' );
        }
    } while ( $prev_revision );

    delete_option( $lock );

    // Add a copy of the post as latest revision.     if ( $add_last ) {
        wp_save_post_revision( $post->ID );
    }

    return true;
}
'what_to_show',
        'rss_language',
        'language',
        'enable_xmlrpc',
        'enable_app',
        'embed_autourls',
        'default_post_edit_rows',
        'gzipcompression',
        'advanced_edit',
    );
    foreach ( $unusedoptions as $option ) {
        delete_option( $option );
    }

    // Delete obsolete magpie stuff.     $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'" );

    // Clear expired transients.     delete_expired_transients( true );
}

/** * Execute WordPress role creation for the various WordPress versions. * * @since 2.0.0 */
return true;
        }

        unset( $paused_extensions[ $this->type ][ $extension ] );

        if ( empty( $paused_extensions[ $this->type ] ) ) {
            unset( $paused_extensions[ $this->type ] );
        }

        // Clean up the entire option if we're removing the only error.         if ( ! $paused_extensions ) {
            return delete_option( $option_name );
        }

        return update_option( $option_name$paused_extensions );
    }

    /** * Gets the error for an extension, if paused. * * @since 5.2.0 * * @param string $extension Plugin or theme directory name. * @return array|null Error that is stored, or null if the extension is not paused. */

function _wp_menus_changed() {
    $old_nav_menu_locations    = get_option( 'theme_switch_menu_locations', array() );
    $new_nav_menu_locations    = get_nav_menu_locations();
    $mapped_nav_menu_locations = wp_map_nav_menu_locations( $new_nav_menu_locations$old_nav_menu_locations );

    set_theme_mod( 'nav_menu_locations', $mapped_nav_menu_locations );
    delete_option( 'theme_switch_menu_locations' );
}

/** * Maps nav menu locations according to assignments in previously active theme. * * @since 4.9.0 * * @param array $new_nav_menu_locations New nav menu locations assignments. * @param array $old_nav_menu_locations Old nav menu locations assignments. * @return array Nav menus mapped to new nav menu locations. */
Home | Imprint | This part of the site doesn't use cookies.