delete_blog_option()WP 3.0.0

Removes an option by name for a given blog ID. Prevents removal of protected WordPress options.

Хуков нет.


true|false. True if the option was deleted, false otherwise.


delete_blog_option( $id, $option );
$id(int) (обязательный)
A blog ID. Can be null to refer to the current blog.
$option(строка) (обязательный)
Name of option to remove. Expected to not be SQL-escaped.

Список изменений

С версии 3.0.0 Введена.

Код delete_blog_option() WP 6.3.1

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 );

	return $return;