the_taxonomies

Display the taxonomies of a post with available options.

Description

the_taxonomies( (array) $args = array() ); 

This function can be used within the loop to display the taxonomies for a post without specifying the Post ID. You can also use it outside the Loop to display the taxonomies for a specific post.

Parameters (1)

0. $args — Optional. (array) => array()
Arguments about which post to use and how to format the output. Shares all of the arguments supported by get_the_taxonomies(), in addition to the following.

Options

  • post (int|WP_Post) => current post

    Post ID or object to get taxonomies of.

  • before (string) => string

    Displays before the taxonomies.

  • sep (string) => is a space

    Separates each taxonomy.

array(

    /**
     * Post ID or object to get taxonomies of.
     *
     * @type int|WP_Post
     * @default current post
     */
    'post' => current post,

    /**
     * Displays before the taxonomies.
     *
     * @type string
     * @default string
     */
    'before' => string,

    /**
     * Separates each taxonomy.
     *
     * @type string
     * @default is a space
     */
    'sep' => is a space
);        


Usage

  1. if ( !function_exists( 'the_taxonomies' ) ) { 
  2. require_once ABSPATH . WPINC . '/taxonomy.php'; 
  3.  
  4. // Arguments about which post to use and how to format the output. Shares all of the arguments supported by get_the_taxonomies(), in addition to the following. 
  5. $args = array( 
  6. 'post' => current post, 
  7. 'before' => string, 
  8. 'sep' => is a space 
  9. ); 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = the_taxonomies($args); 
  13.  

Defined (1)

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

/wp-includes/taxonomy.php  
  1. function the_taxonomies( $args = array() ) { 
  2. $defaults = array( 
  3. 'post' => 0,  
  4. 'before' => '',  
  5. 'sep' => ' ',  
  6. 'after' => '',  
  7. ); 
  8.  
  9. $r = wp_parse_args( $args, $defaults ); 
  10.  
  11. echo $r['before'] . join( $r['sep'], get_the_taxonomies( $r['post'], $r ) ) . $r['after'];