On this page
update_blog_status( int $blog_id, string $pref, string $value, null $deprecated = null ): string|false
Update a blog details field.
Parameters
$blog_idint Required-
Blog ID.
$prefstring Required-
Field name.
$valuestring Required-
Field value.
$deprecatednull Optional-
Not used.
Default:
null
Return
string|false $value
Source
File: wp-includes/ms-blogs.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| wp_update_site() wp-includes/ms-site.php | Updates a site in the database. |
| _deprecated_argument() wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| is_wp_error() wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
Used By
| Used By | Description |
|---|---|
| wpmu_delete_blog() wp-admin/includes/ms.php | Delete a site. |
| update_blog_public() wp-includes/ms-functions.php | Updates this blog’s ‘public’ setting in the global blogs table. |
| update_archived() wp-includes/ms-blogs.php | Update the ‘archived’ status of a particular blog. |
Changelog
| Version | Description |
|---|---|
| MU (3.0.0) | MU (3.0.0) |
| 5.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/update_blog_status