delete_blog_option()

最后更新于:2021-11-26 00:03:26

delete_blog_option( int$id, string$option)

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

参数

$id

(int) (Required) A blog ID. Can be null to refer to the current blog.

$option

(string) (Required) Name of option to remove. Expected to not be SQL-escaped.

响应

(bool) True if the option was deleted, false otherwise.

源文件

文件: gc-includes/ms-blogs.php

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