_post_format_get_terms

Remove the post format prefix from the name property of the term objects created by get_terms().

Description

(array) _post_format_get_terms( (array) $terms, (string|array) $taxonomies, (array) $args ); 

Returns (array)

Parameters (3)

0. $terms (array)
The terms.
1. $taxonomies (string|array)
The taxonomies.
2. $args (array)
The args.

Usage

  1. if ( !function_exists( '_post_format_get_terms' ) ) { 
  2. require_once ABSPATH . WPINC . '/post-formats.php'; 
  3.  
  4. // The terms. 
  5. $terms = array(); 
  6.  
  7. // The taxonomies. 
  8. $taxonomies = null; 
  9.  
  10. // The args. 
  11. $args = array(); 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = _post_format_get_terms($terms, $taxonomies, $args); 
  15.  

Defined (1)

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

/wp-includes/post-formats.php  
  1. function _post_format_get_terms( $terms, $taxonomies, $args ) { 
  2. if ( in_array( 'post_format', (array) $taxonomies ) ) { 
  3. if ( isset( $args['fields'] ) && 'names' == $args['fields'] ) { 
  4. foreach ( $terms as $order => $name ) { 
  5. $terms[$order] = get_post_format_string( str_replace( 'post-format-', '', $name ) ); 
  6. } else { 
  7. foreach ( (array) $terms as $order => $term ) { 
  8. if ( isset( $term->taxonomy ) && 'post_format' == $term->taxonomy ) { 
  9. $terms[$order]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); 
  10. return $terms;