replace_meta

Used for imports, both in dashboard and import settings pages, this functions either copies $old_metakey into $new_metakey or just plain replaces $old_metakey with $new_metakey.

Description

replace_meta( (string) $old_metakey, (string) $new_metakey, (bool) $replace = false ); 

Parameters (3)

0. $old_metakey (string)
The old name of the meta value.
1. $new_metakey (string)
The new name of the meta value, usually the Yoast SEO name.
2. $replace — Optional. (bool) => false
Whether to replace or to copy the values.

Usage

  1. if ( !function_exists( 'replace_meta' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/inc/wpseo-functions-deprecated.php'; 
  3.  
  4. // The old name of the meta value. 
  5. $old_metakey = ''; 
  6.  
  7. // The new name of the meta value, usually the Yoast SEO name. 
  8. $new_metakey = ''; 
  9.  
  10. // Whether to replace or to copy the values. 
  11. $replace = false; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = replace_meta($old_metakey, $new_metakey, $replace); 
  15.  

Defined (1)

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

/inc/wpseo-functions-deprecated.php  
  1. function replace_meta( $old_metakey, $new_metakey, $replace = false ) { 
  2. _deprecated_function( __FUNCTION__, 'WPSEO 1.5.0', 'WPSEO_Meta::replace_meta()' ); 
  3. WPSEO_Meta::replace_meta( $old_metakey, $new_metakey, $replace );