wpseo_upsert_new

Insert a new value.

Description

(string) wpseo_upsert_new( (string) $what, (int) $post_id, (string) $new, (string) $original ); 

Returns (string)

Parameters (4)

0. $what (string)
Item type (such as title).
1. $post_id (int)
The post id.
2. $new (string)
New value to record.
3. $original (string)
Original value.

Usage

  1. if ( !function_exists( 'wpseo_upsert_new' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/admin/ajax.php'; 
  3.  
  4. // Item type (such as title). 
  5. $what = ''; 
  6.  
  7. // The post id. 
  8. $post_id = -1; 
  9.  
  10. // New value to record. 
  11. $new = ''; 
  12.  
  13. // Original value. 
  14. $original = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = wpseo_upsert_new($what, $post_id, $new, $original); 
  18.  

Defined (1)

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

/admin/ajax.php  
  1. function wpseo_upsert_new( $what, $post_id, $new, $original ) { 
  2. $meta_key = WPSEO_Meta::$meta_prefix . $what; 
  3.  
  4. return wpseo_upsert_meta( $post_id, $new, $original, $meta_key, $what );