wpseo_save_all

Utility function to save values.

Description

wpseo_save_all( (string) $what ); 

Parameters (1)

0. $what (string)
Type of item so save.

Usage

  1. if ( !function_exists( 'wpseo_save_all' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/admin/ajax.php'; 
  3.  
  4. // Type of item so save. 
  5. $what = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpseo_save_all($what); 
  9.  

Defined (1)

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

/admin/ajax.php  
  1. function wpseo_save_all( $what ) { 
  2. check_ajax_referer( 'wpseo-bulk-editor' ); 
  3.  
  4. // @todo the WPSEO Utils class can't filter arrays in POST yet. 
  5. $new_values = $_POST['items']; 
  6. $original_values = $_POST['existing_items']; 
  7.  
  8. $results = array(); 
  9.  
  10. if ( is_array( $new_values ) && $new_values !== array() ) { 
  11. foreach ( $new_values as $post_id => $new_value ) { 
  12. $original_value = $original_values[ $post_id ]; 
  13. $results[] = wpseo_upsert_new( $what, $post_id, $new_value, $original_value ); 
  14. wpseo_ajax_json_echo_die( $results );