wpseo_get_terms

Retrieve a post's terms, comma delimited.

Description

(string) wpseo_get_terms( (int) $id, (string) $taxonomy, (bool) $return_single = false ); 

Returns (string)

either a single term or a comma delimited string of terms.

Parameters (3)

0. $id (int)
ID of the post to get the terms for.
1. $taxonomy (string)
The taxonomy to get the terms for this post from.
2. $return_single — Optional. (bool) => false
If true, return the first term.

Usage

  1. if ( !function_exists( 'wpseo_get_terms' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/inc/wpseo-functions-deprecated.php'; 
  3.  
  4. // ID of the post to get the terms for. 
  5. $id = -1; 
  6.  
  7. // The taxonomy to get the terms for this post from. 
  8. $taxonomy = ''; 
  9.  
  10. // If true, return the first term. 
  11. $return_single = false; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = wpseo_get_terms($id, $taxonomy, $return_single); 
  15.  

Defined (1)

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

/inc/wpseo-functions-deprecated.php  
  1. function wpseo_get_terms( $id, $taxonomy, $return_single = false ) { 
  2. _deprecated_function( __FUNCTION__, 'WPSEO 1.5.4', 'WPSEO_Replace_Vars::get_terms()' ); 
  3. $replacer = new WPSEO_Replace_Vars; 
  4.  
  5. return $replacer->get_terms( $id, $taxonomy, $return_single );