update_blog_option

Update an option for a particular blog.

Description

update_blog_option( (int) $id, (string) $option, (mixed) $value, (null) $deprecated = null ); 

Parameters (4)

0. $id (int)
The blog id.
1. $option (string)
The option key.
2. $value (mixed)
The option value.
3. $deprecated — Optional. (null) => null
The deprecated.

Usage

  1. if ( !function_exists( 'update_blog_option' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-blogs.php'; 
  3.  
  4. // The blog id. 
  5. $id = -1; 
  6.  
  7. // The option key. 
  8. $option = ''; 
  9.  
  10. // The option value. 
  11. $value = null; 
  12.  
  13. // The deprecated. 
  14. $deprecated = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = update_blog_option($id, $option, $value, $deprecated); 
  18.  

Defined (1)

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

/wp-includes/ms-blogs.php  
  1. function update_blog_option( $id, $option, $value, $deprecated = null ) { 
  2. $id = (int) $id; 
  3.  
  4. if ( null !== $deprecated ) 
  5. _deprecated_argument( __FUNCTION__, '3.1.0' ); 
  6.  
  7. if ( get_current_blog_id() == $id ) 
  8. return update_option( $option, $value ); 
  9.  
  10. switch_to_blog( $id ); 
  11. $return = update_option( $option, $value ); 
  12.  
  13. return $return;