Uses
Uses | Description |
---|---|
wp-includes/functions.php: wp_parse_args() | Merge user defined arguments into defaults array. |
wp-includes/taxonomy.php: get_the_taxonomies() | Retrieve all taxonomies associated with a post. |
Display the taxonomies of a post with available options.
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.
(array) (Optional) 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.
(int|WP_Post) Post ID or object to get taxonomies of. Default current post.
(string) Displays before the taxonomies. Default empty string.
(string) Separates each taxonomy. Default is a space.
(string) Displays after the taxonomies. Default empty string.
Default value: array()
File: wp-includes/taxonomy.php
function the_taxonomies( $args = array() ) { $defaults = array( 'post' => 0, 'before' => '', 'sep' => ' ', 'after' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); echo $parsed_args['before'] . join( $parsed_args['sep'], get_the_taxonomies( $parsed_args['post'], $parsed_args ) ) . $parsed_args['after']; }
Version | Description |
---|---|
2.5.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/the_taxonomies