update_blog_status

The timeline below displays how wordpress function update_blog_status has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Updates a blog details field.
 *
 * @since MU (3.0.0)
 * @since 5.1.0 Use wp_update_site() internally.
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $blog_id    Blog ID.
 * @param string $pref       Field name.
 * @param string $value      Field value.
 * @param null   $deprecated Not used.
 * @return string|false $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1.0');
    }
    $allowed_field_names = array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
    if (!in_array($pref, $allowed_field_names, true)) {
        return $value;
    }
    $result = wp_update_site($blog_id, array($pref => $value));
    if (is_wp_error($result)) {
        return false;
    }
    return $value;
}

WordPress Version: 5.5

/**
 * Update a blog details field.
 *
 * @since MU (3.0.0)
 * @since 5.1.0 Use wp_update_site() internally.
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $blog_id    Blog ID.
 * @param string $pref       Field name.
 * @param string $value      Field value.
 * @param null   $deprecated Not used.
 * @return string|false $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1.0');
    }
    $allowed_field_names = array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
    if (!in_array($pref, $allowed_field_names, true)) {
        return $value;
    }
    $result = wp_update_site($blog_id, array($pref => $value));
    if (is_wp_error($result)) {
        return false;
    }
    return $value;
}

WordPress Version: 5.3

/**
 * Update a blog details field.
 *
 * @since MU (3.0.0)
 * @since 5.1.0 Use wp_update_site() internally.
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $blog_id    Blog ID.
 * @param string $pref       Field name.
 * @param string $value      Field value.
 * @param null   $deprecated Not used.
 * @return string|false $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1.0');
    }
    if (!in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'))) {
        return $value;
    }
    $result = wp_update_site($blog_id, array($pref => $value));
    if (is_wp_error($result)) {
        return false;
    }
    return $value;
}

WordPress Version: 5.1

/**
 * Update a blog details field.
 *
 * @since MU (3.0.0)
 * @since 5.1.0 Use wp_update_site() internally.
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $blog_id BLog ID
 * @param string $pref    A field name
 * @param string $value   Value for $pref
 * @param null   $deprecated
 * @return string|false $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1.0');
    }
    if (!in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'))) {
        return $value;
    }
    $result = wp_update_site($blog_id, array($pref => $value));
    if (is_wp_error($result)) {
        return false;
    }
    return $value;
}

WordPress Version: 4.9

/**
 * Update a blog details field.
 *
 * @since MU (3.0.0)
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $blog_id BLog ID
 * @param string $pref    A field name
 * @param string $value   Value for $pref
 * @param null   $deprecated
 * @return string|false $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1.0');
    }
    if (!in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'))) {
        return $value;
    }
    $result = $wpdb->update($wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    clean_blog_cache($blog_id);
    if ('spam' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_spam_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_ham_blog', $blog_id);
        }
    } elseif ('mature' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('mature_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unmature_blog', $blog_id);
        }
    } elseif ('archived' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('archive_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unarchive_blog', $blog_id);
        }
    } elseif ('deleted' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_delete_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_undelete_blog', $blog_id);
        }
    } elseif ('public' == $pref) {
        /**
         * Fires after the current blog's 'public' setting is updated.
         *
         * @since MU (3.0.0)
         *
         * @param int    $blog_id Blog ID.
         * @param string $value   The value of blog status.
         */
        do_action('update_blog_public', $blog_id, $value);
        // Moved here from update_blog_public().
    }
    return $value;
}

WordPress Version: 4.6

/**
 * Update a blog details field.
 *
 * @since MU
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $blog_id BLog ID
 * @param string $pref    A field name
 * @param string $value   Value for $pref
 * @param null   $deprecated
 * @return string|false $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1.0');
    }
    if (!in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'))) {
        return $value;
    }
    $result = $wpdb->update($wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    refresh_blog_details($blog_id);
    if ('spam' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_spam_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_ham_blog', $blog_id);
        }
    } elseif ('mature' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('mature_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unmature_blog', $blog_id);
        }
    } elseif ('archived' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('archive_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unarchive_blog', $blog_id);
        }
    } elseif ('deleted' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_delete_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_undelete_blog', $blog_id);
        }
    } elseif ('public' == $pref) {
        /**
         * Fires after the current blog's 'public' setting is updated.
         *
         * @since MU
         *
         * @param int    $blog_id Blog ID.
         * @param string $value   The value of blog status.
         */
        do_action('update_blog_public', $blog_id, $value);
        // Moved here from update_blog_public().
    }
    return $value;
}

WordPress Version: 4.4

/**
 * Update a blog details field.
 *
 * @since MU
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $blog_id BLog ID
 * @param string $pref    A field name
 * @param string $value   Value for $pref
 * @param null   $deprecated
 * @return string|false $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1');
    }
    if (!in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'))) {
        return $value;
    }
    $result = $wpdb->update($wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    refresh_blog_details($blog_id);
    if ('spam' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_spam_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_ham_blog', $blog_id);
        }
    } elseif ('mature' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('mature_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unmature_blog', $blog_id);
        }
    } elseif ('archived' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('archive_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unarchive_blog', $blog_id);
        }
    } elseif ('deleted' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_delete_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_undelete_blog', $blog_id);
        }
    } elseif ('public' == $pref) {
        /**
         * Fires after the current blog's 'public' setting is updated.
         *
         * @since MU
         *
         * @param int    $blog_id Blog ID.
         * @param string $value   The value of blog status.
         */
        do_action('update_blog_public', $blog_id, $value);
        // Moved here from update_blog_public().
    }
    return $value;
}

WordPress Version: 4.3

/**
 * Update a blog details field.
 *
 * @since MU
 *
 * @global wpdb $wpdb
 *
 * @param int    $blog_id BLog ID
 * @param string $pref    A field name
 * @param string $value   Value for $pref
 * @param null   $deprecated
 * @return string|false $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1');
    }
    if (!in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'))) {
        return $value;
    }
    $result = $wpdb->update($wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    refresh_blog_details($blog_id);
    if ('spam' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_spam_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_ham_blog', $blog_id);
        }
    } elseif ('mature' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('mature_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unmature_blog', $blog_id);
        }
    } elseif ('archived' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('archive_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unarchive_blog', $blog_id);
        }
    } elseif ('deleted' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_delete_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_undelete_blog', $blog_id);
        }
    } elseif ('public' == $pref) {
        /**
         * Fires after the current blog's 'public' setting is updated.
         *
         * @since MU
         *
         * @param int    $blog_id Blog ID.
         * @param string $value   The value of blog status.
         */
        do_action('update_blog_public', $blog_id, $value);
        // Moved here from update_blog_public().
    }
    return $value;
}

WordPress Version: 3.8

/**
 * Update a blog details field.
 *
 * @since MU
 *
 * @param int $blog_id BLog ID
 * @param string $pref A field name
 * @param string $value Value for $pref
 * @return string $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1');
    }
    if (!in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'))) {
        return $value;
    }
    $result = $wpdb->update($wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    refresh_blog_details($blog_id);
    if ('spam' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_spam_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_ham_blog', $blog_id);
        }
    } elseif ('mature' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('mature_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unmature_blog', $blog_id);
        }
    } elseif ('archived' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('archive_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('unarchive_blog', $blog_id);
        }
    } elseif ('deleted' == $pref) {
        if ($value == 1) {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_delete_blog', $blog_id);
        } else {
            /** This filter is documented in wp-includes/ms-blogs.php */
            do_action('make_undelete_blog', $blog_id);
        }
    } elseif ('public' == $pref) {
        /**
         * Fires after the current blog's 'public' setting is updated.
         *
         * @since MU
         *
         * @param int    $blog_id Blog ID.
         * @param string $value   The value of blog status.
         */
        do_action('update_blog_public', $blog_id, $value);
        // Moved here from update_blog_public().
    }
    return $value;
}

WordPress Version: 3.7

/**
 * Update a blog details field.
 *
 * @since MU
 *
 * @param int $blog_id BLog ID
 * @param string $pref A field name
 * @param string $value Value for $pref
 * @return string $value
 */
function update_blog_status($blog_id, $pref, $value, $deprecated = null)
{
    global $wpdb;
    if (null !== $deprecated) {
        _deprecated_argument(__FUNCTION__, '3.1');
    }
    if (!in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id'))) {
        return $value;
    }
    $result = $wpdb->update($wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    refresh_blog_details($blog_id);
    if ('spam' == $pref) {
        ($value == 1) ? do_action('make_spam_blog', $blog_id) : do_action('make_ham_blog', $blog_id);
    } elseif ('mature' == $pref) {
        ($value == 1) ? do_action('mature_blog', $blog_id) : do_action('unmature_blog', $blog_id);
    } elseif ('archived' == $pref) {
        ($value == 1) ? do_action('archive_blog', $blog_id) : do_action('unarchive_blog', $blog_id);
    } elseif ('deleted' == $pref) {
        ($value == 1) ? do_action('make_delete_blog', $blog_id) : do_action('make_undelete_blog', $blog_id);
    } elseif ('public' == $pref) {
        do_action('update_blog_public', $blog_id, $value);
    }
    // Moved here from update_blog_public().
    return $value;
}