delete_blog_option

Removes option by name for a given blog id.

Description

delete_blog_option( (int) $id, (string) $option ); 

Prevents removal of protected WordPress options.

Parameters (2)

0. $id (int)
A blog ID. Can be null to refer to the current blog.
1. $option (string)
Name of option to remove. Expected to not be SQL-escaped.

Usage

  1. if ( !function_exists( 'delete_blog_option' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-blogs.php'; 
  3.  
  4. // A blog ID. Can be null to refer to the current blog. 
  5. $id = -1; 
  6.  
  7. // Name of option to remove. Expected to not be SQL-escaped. 
  8. $option = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = delete_blog_option($id, $option); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-blogs.php  
  1. function delete_blog_option( $id, $option ) { 
  2. $id = (int) $id; 
  3.  
  4. if ( empty( $id ) ) 
  5.  
  6. if ( get_current_blog_id() == $id ) 
  7. return delete_option( $option ); 
  8.  
  9. switch_to_blog( $id ); 
  10. $return = delete_option( $option ); 
  11.  
  12. return $return;