wp_set_sidebars_widgets

Set the sidebar widget option to update sidebars.

Description

wp_set_sidebars_widgets( (array) $sidebars_widgets ); 

Parameters (1)

0. $sidebars_widgets (array)
Sidebar widgets and their settings.

Usage

  1. if ( !function_exists( 'wp_set_sidebars_widgets' ) ) { 
  2. require_once ABSPATH . WPINC . '/widgets.php'; 
  3.  
  4. // Sidebar widgets and their settings. 
  5. $sidebars_widgets = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_set_sidebars_widgets($sidebars_widgets); 
  9.  

Defined (1)

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

/wp-includes/widgets.php  
  1. function wp_set_sidebars_widgets( $sidebars_widgets ) { 
  2. if ( !isset( $sidebars_widgets['array_version'] ) ) 
  3. $sidebars_widgets['array_version'] = 3; 
  4. update_option( 'sidebars_widgets', $sidebars_widgets );