the_terms

Advertisement

Summery Summery

Display the terms in a list.

Syntax Syntax

the_terms( int $id, string $taxonomy, string $before = '', string $sep = ', ', string $after = '' )

Parameters Parameters

$id

(Required) Post ID.

$taxonomy

(Required) Taxonomy name.

$before

(Optional) Before list.

Default value: ''

$sep

(Optional) Separate items using this.

Default value: ', '

$after

(Optional) After list.

Default value: ''

Return Return

(false|void) False on WordPress error.

Source Source

File: wp-includes/category-template.php

	$term_id = $term->term_id;

	$defaults = array(
		'format'    => 'name',
		'separator' => '/',
		'link'      => true,
		'inclusive' => true,
	);

	$args = wp_parse_args( $args, $defaults );

	foreach ( array( 'link', 'inclusive' ) as $bool ) {
		$args[ $bool ] = wp_validate_boolean( $args[ $bool ] );
	}

	$parents = get_ancestors( $term_id, $taxonomy, 'taxonomy' );

	if ( $args['inclusive'] ) {
		array_unshift( $parents, $term_id );
	}

Advertisement

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Advertisement

Leave a Reply