On this page
delete_blog_option( int $id, string $option ): bool
Removes option by name for a given blog ID. Prevents removal of protected WordPress options.
Parameters
$idint Required-
A blog ID. Can be null to refer to the current blog.
$optionstring Required-
Name of option to remove. Expected to not be SQL-escaped.
Return
bool True if the option was deleted, false otherwise.
Source
File: wp-includes/ms-blogs.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| switch_to_blog() wp-includes/ms-blogs.php | Switch the current blog. |
| delete_option() wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| restore_current_blog() wp-includes/ms-blogs.php | Restore the current blog, after calling switch_to_blog() . |
| get_current_blog_id() wp-includes/load.php | Retrieve the current site ID. |
Changelog
| Version | Description |
|---|---|
| MU (3.0.0) | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/delete_blog_option