update_site_option example

'attempted'  => $core_update->current,
                'current'    => $wp_version,
                'error_code' => $error_code,
                'error_data' => $result->get_error_data(),
                'timestamp'  => time(),
                'critical'   => true,
            );
            if ( isset( $rollback_result ) ) {
                $critical_data['rollback_code'] = $rollback_result->get_error_code();
                $critical_data['rollback_data'] = $rollback_result->get_error_data();
            }
            update_site_option( 'auto_core_update_failed', $critical_data );
            $this->send_email( 'critical', $core_update$result );
            return;
        }

        /* * Any other WP_Error code (like download_failed or files_not_writable) occurs before * we tried to copy over core files. Thus, the failures are early and graceful. * * We should avoid trying to perform a background update again for the same version. * But we can try again if another version is released. * * For certain 'transient' failures, like download_failed, we should allow retries. * In fact, let's schedule a special update for an hour from now. (It's possible * the issue could actually be on WordPress.org's side.) If that one fails, then email. */

function wp_ajax_wp_compression_test() {
    if ( ! current_user_can( 'manage_options' ) ) {
        wp_die( -1 );
    }

    if ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) ) {
        // Use `update_option()` on single site to mark the option for autoloading.         if ( is_multisite() ) {
            update_site_option( 'can_compress_scripts', 0 );
        } else {
            update_option( 'can_compress_scripts', 0, 'yes' );
        }
        wp_die( 0 );
    }

    if ( isset( $_GET['test'] ) ) {
        header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
        header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
        header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
        header( 'Content-Type: application/javascript; charset=UTF-8' );
        


        if ( ! is_array( $stylesheets ) ) {
            $stylesheets = array( $stylesheets );
        }

        $allowed_themes = get_site_option( 'allowedthemes' );
        foreach ( $stylesheets as $stylesheet ) {
            $allowed_themes[ $stylesheet ] = true;
        }

        update_site_option( 'allowedthemes', $allowed_themes );
    }

    /** * Disables a theme for all sites on the current network. * * @since 4.6.0 * * @param string|string[] $stylesheets Stylesheet name or array of stylesheet names. */
    public static function network_disable_theme( $stylesheets ) {
        if ( ! is_multisite() ) {
            


        if ( in_array( $scheme, array( 'auth', 'secure_auth', 'logged_in', 'nonce' ), true ) ) {
            foreach ( array( 'key', 'salt' ) as $type ) {
                $const = strtoupper( "{$scheme}_{$type});
                if ( defined( $const ) && constant( $const ) && empty( $duplicated_keys[ constant( $const ) ] ) ) {
                    $values[ $type ] = constant( $const );
                } elseif ( ! $values[ $type ] ) {
                    $values[ $type ] = get_site_option( "{$scheme}_{$type});
                    if ( ! $values[ $type ] ) {
                        $values[ $type ] = wp_generate_password( 64, true, true );
                        update_site_option( "{$scheme}_{$type}", $values[ $type ] );
                    }
                }
            }
        } else {
            if ( ! $values['key'] ) {
                $values['key'] = get_site_option( 'secret_key' );
                if ( ! $values['key'] ) {
                    $values['key'] = wp_generate_password( 64, true, true );
                    update_site_option( 'secret_key', $values['key'] );
                }
            }
            

        );
        update_site_option( 'welcome_user_email', $text );
    }
    return $text;
}

/** * Determines whether to force SSL on content. * * @since 2.8.5 * * @param bool $force * @return bool True if forced, false if not forced. */


        if ( ! defined( 'AUTH_KEY' ) || in_array( AUTH_KEY, $default_keys, true ) ) {
            $auth_key = get_site_option( 'recovery_mode_auth_key' );

            if ( ! $auth_key ) {
                if ( ! function_exists( 'wp_generate_password' ) ) {
                    require_once ABSPATH . WPINC . '/pluggable.php';
                }

                $auth_key = wp_generate_password( 64, true, true );
                update_site_option( 'recovery_mode_auth_key', $auth_key );
            }
        } else {
            $auth_key = AUTH_KEY;
        }

        if ( ! defined( 'AUTH_SALT' ) || in_array( AUTH_SALT, $default_keys, true ) || AUTH_SALT === $auth_key ) {
            $auth_salt = get_site_option( 'recovery_mode_auth_salt' );

            if ( ! $auth_salt ) {
                if ( ! function_exists( 'wp_generate_password' ) ) {
                    require_once ABSPATH . WPINC . '/pluggable.php';
                }

function dismiss_core_update( $update ) {
    $dismissed = get_site_option( 'dismissed_update_core' );
    $dismissed[ $update->current . '|' . $update->locale ] = true;

    return update_site_option( 'dismissed_update_core', $dismissed );
}

/** * Undismisses core update. * * @since 2.7.0 * * @param string $version * @param string $locale * @return bool */


// Used in the HTML title tag. $title       = __( 'Network Settings' );
$parent_file = 'settings.php';

// Handle network admin email change requests. if ( ! empty( $_GET['network_admin_hash'] ) ) {
    $new_admin_details = get_site_option( 'network_admin_hash' );
    $redirect          = 'settings.php?updated=false';
    if ( is_array( $new_admin_details ) && hash_equals( $new_admin_details['hash']$_GET['network_admin_hash'] ) && ! empty( $new_admin_details['newemail'] ) ) {
        update_site_option( 'admin_email', $new_admin_details['newemail'] );
        delete_site_option( 'network_admin_hash' );
        delete_site_option( 'new_admin_email' );
        $redirect = 'settings.php?updated=true';
    }
    wp_redirect( network_admin_url( $redirect ) );
    exit;
} elseif ( ! empty( $_GET['dismiss'] ) && 'new_network_admin_email' === $_GET['dismiss'] ) {
    check_admin_referer( 'dismiss_new_network_admin_email' );
    delete_site_option( 'network_admin_hash' );
    delete_site_option( 'new_admin_email' );
    wp_redirect( network_admin_url( 'settings.php?updated=true' ) );
    

function _upgrade_core_deactivate_incompatible_plugins() {
    if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '14.1', '<' ) ) {
        $deactivated_gutenberg['gutenberg'] = array(
            'plugin_name'         => 'Gutenberg',
            'version_deactivated' => GUTENBERG_VERSION,
            'version_compatible'  => '14.1',
        );
        if ( is_plugin_active_for_network( 'gutenberg/gutenberg.php' ) ) {
            $deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins', array() );
            $deactivated_plugins = array_merge( $deactivated_plugins$deactivated_gutenberg );
            update_site_option( 'wp_force_deactivated_plugins', $deactivated_plugins );
        } else {
            $deactivated_plugins = get_option( 'wp_force_deactivated_plugins', array() );
            $deactivated_plugins = array_merge( $deactivated_plugins$deactivated_gutenberg );
            update_option( 'wp_force_deactivated_plugins', $deactivated_plugins );
        }
        deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true );
    }
}
check_admin_referer( 'updates' );

        $all_items    = wp_get_themes();
        $auto_updates = (array) get_site_option( 'auto_update_themes', array() );

        $auto_updates[] = $_GET['stylesheet'];
        $auto_updates   = array_unique( $auto_updates );
        // Remove themes that have been deleted since the site option was last updated.         $auto_updates = array_intersect( $auto_updatesarray_keys( $all_items ) );

        update_site_option( 'auto_update_themes', $auto_updates );

        wp_redirect( admin_url( 'themes.php?enabled-auto-update=true' ) );

        exit;
    } elseif ( 'disable-auto-update' === $_GET['action'] ) {
        if ( ! ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) ) {
            wp_die( __( 'Sorry, you are not allowed to disable themes automatic updates.' ) );
        }

        check_admin_referer( 'updates' );

        
if ( ! current_user_can( 'update_core' ) ) {
        wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
    }

    $redirect_url = self_admin_url( 'update-core.php' );

    if ( isset( $_GET['value'] ) ) {
        check_admin_referer( 'core-major-auto-updates-nonce' );

        if ( 'enable' === $_GET['value'] ) {
            update_site_option( 'auto_update_core_major', 'enabled' );
            $redirect_url = add_query_arg( 'core-major-auto-updates-saved', 'enabled', $redirect_url );
        } elseif ( 'disable' === $_GET['value'] ) {
            update_site_option( 'auto_update_core_major', 'disabled' );
            $redirect_url = add_query_arg( 'core-major-auto-updates-saved', 'disabled', $redirect_url );
        }
    }

    wp_redirect( $redirect_url );
    exit;
} else {
    /** * Fires for each custom update action on the WordPress Updates screen. * * The dynamic portion of the hook name, `$action`, refers to the * passed update action. The hook fires in lieu of all available * default update actions. * * @since 3.2.0 */

    do_action( 'grant_super_admin', $user_id );

    // Directly fetch site_admins instead of using get_super_admins().     $super_admins = get_site_option( 'site_admins', array( 'admin' ) );

    $user = get_userdata( $user_id );
    if ( $user && ! in_array( $user->user_login, $super_admins, true ) ) {
        $super_admins[] = $user->user_login;
        update_site_option( 'site_admins', $super_admins );

        /** * Fires after the user is granted Super Admin privileges. * * @since 3.0.0 * * @param int $user_id ID of the user that was granted Super Admin privileges. */
        do_action( 'granted_super_admin', $user_id );
        return true;
    }
    
 else {
                    $auto_updates = array_diff( $auto_updates$themes );
                    $referer      = add_query_arg( 'disabled-auto-update', count( $themes )$referer );
                }
            }

            $all_items = wp_get_themes();

            // Remove themes that don't exist or have been deleted since the option was last updated.             $auto_updates = array_intersect( $auto_updatesarray_keys( $all_items ) );

            update_site_option( 'auto_update_themes', $auto_updates );

            wp_safe_redirect( $referer );
            exit;
        default:
            $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
            if ( empty( $themes ) ) {
                wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) );
                exit;
            }
            check_admin_referer( 'bulk-themes' );

            

            do_action( "activate_{$plugin}", $network_wide );
        }

        if ( $network_wide ) {
            $current            = get_site_option( 'active_sitewide_plugins', array() );
            $current[ $plugin ] = time();
            update_site_option( 'active_sitewide_plugins', $current );
        } else {
            $current   = get_option( 'active_plugins', array() );
            $current[] = $plugin;
            sort( $current );
            update_option( 'active_plugins', $current );
        }

        if ( ! $silent ) {
            /** * Fires after a plugin has been activated. * * If a plugin is silently activated (such as during an update), * this hook does not fire. * * @since 2.9.0 * * @param string $plugin Path to the plugin file relative to the plugins directory. * @param bool $network_wide Whether to enable the plugin for all sites in the network * or just the current site. Multisite only. Default false. */
// 2.8.0     if ( $wp_current_db_version < 11549 ) {
        $wpmu_sitewide_plugins   = get_site_option( 'wpmu_sitewide_plugins' );
        $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' );
        if ( $wpmu_sitewide_plugins ) {
            if ( ! $active_sitewide_plugins ) {
                $sitewide_plugins = (array) $wpmu_sitewide_plugins;
            } else {
                $sitewide_plugins = array_merge( (array) $active_sitewide_plugins(array) $wpmu_sitewide_plugins );
            }

            update_site_option( 'active_sitewide_plugins', $sitewide_plugins );
        }
        delete_site_option( 'wpmu_sitewide_plugins' );
        delete_site_option( 'deactivated_sitewide_plugins' );

        $start = 0;
        while ( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20" ) ) {
            foreach ( $rows as $row ) {
                $value = $row->meta_value;
                if ( ! @unserialize( $value ) ) {
                    $value = stripslashes( $value );
                }
                
Home | Imprint | This part of the site doesn't use cookies.