wpseo_set_value

Save a custom meta value.

Description

wpseo_set_value( (string) $meta_key, (mixed) $meta_value, (int) $post_id ); 

Parameters (3)

0. $meta_key (string)
The meta to change.
1. $meta_value (mixed)
The value to set the meta to.
2. $post_id (int)
The ID of the post to change the meta for.

Usage

  1. if ( !function_exists( 'wpseo_set_value' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/inc/wpseo-functions-deprecated.php'; 
  3.  
  4. // The meta to change. 
  5. $meta_key = ''; 
  6.  
  7. // The value to set the meta to. 
  8. $meta_value = null; 
  9.  
  10. // The ID of the post to change the meta for. 
  11. $post_id = -1; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = wpseo_set_value($meta_key, $meta_value, $post_id); 
  15.  

Defined (1)

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

/inc/wpseo-functions-deprecated.php  
  1. function wpseo_set_value( $meta_key, $meta_value, $post_id ) { 
  2. _deprecated_function( __FUNCTION__, 'WPSEO 1.5.0', 'WPSEO_Meta::set_value()' ); 
  3.  
  4. return WPSEO_Meta::set_value( $meta_key, $meta_value, $post_id );