clean_blog_cache example

$prepared_data = wp_prepare_site_data( $data$defaults );
    if ( is_wp_error( $prepared_data ) ) {
        return $prepared_data;
    }

    if ( false === $wpdb->insert( $wpdb->blogs, $prepared_data ) ) {
        return new WP_Error( 'db_insert_error', __( 'Could not insert site into the database.' )$wpdb->last_error );
    }

    $site_id = (int) $wpdb->insert_id;

    clean_blog_cache( $site_id );

    $new_site = get_site( $site_id );

    if ( ! $new_site ) {
        return new WP_Error( 'get_site_error', __( 'Could not retrieve site data.' ) );
    }

    /** * Fires once a site has been inserted into the database. * * @since 5.1.0 * * @param WP_Site $new_site New site object. */
$data = array(
        'domain'  => $domain,
        'path'    => $path,
        'site_id' => $site_id,
    );

    $site_id = wp_insert_site( $data );
    if ( is_wp_error( $site_id ) ) {
        return false;
    }

    clean_blog_cache( $site_id );

    return $site_id;
}

/** * Install an empty blog. * * Creates the new blog tables and options. If calling this function * directly, be sure to use switch_to_blog() first, so that $wpdb * points to the new blog. * * @since MU (3.0.0) * @deprecated 5.1.0 * * @global wpdb $wpdb WordPress database abstraction object. * @global WP_Roles $wp_roles WordPress role management object. * * @param int $blog_id The value returned by wp_insert_site(). * @param string $blog_title The title of the new site. */

function refresh_blog_details( $blog_id = 0 ) {
    $blog_id = (int) $blog_id;
    if ( ! $blog_id ) {
        $blog_id = get_current_blog_id();
    }

    clean_blog_cache( $blog_id );
}

/** * Updates the details for a blog and the blogs table for a given blog ID. * * @since MU (3.0.0) * * @global wpdb $wpdb WordPress database abstraction object. * * @param int $blog_id Blog ID. * @param array $details Array of details keyed by blogs table field names. * @return bool True if update succeeds, false otherwise. */
foreach ( $rows as $row ) {
                $value = maybe_unserialize( $row->option_value );
                if ( $value === $row->option_value ) {
                    $value = stripslashes( $value );
                }
                if ( $value !== $row->option_value ) {
                    update_option( $row->option_name, $value );
                }
            }
            $start += 20;
        }
        clean_blog_cache( get_current_blog_id() );
    }
}

/** * Execute changes made in WordPress 2.9. * * @ignore * @since 2.9.0 * * @global int $wp_current_db_version The old (current) database version. */
Home | Imprint | This part of the site doesn't use cookies.