A WordPress-centric search engine for devs and theme authors



the_terms ›

Since2.5.0
Deprecatedn/a
the_terms ( $id, $taxonomy, $before = '', $sep = ', ', $after = '' )
Parameters: (5)
  • (int) $id Post ID.
    Required: Yes
  • (string) $taxonomy Taxonomy name.
    Required: Yes
  • (string) $before Optional. Before list.
    Required: No
    Default: (empty)
  • (string) $sep Optional. Separate items using this.
    Required: No
    Default: ', '
  • (string) $after Optional. After list.
    Required: No
    Default: (empty)
Returns:
  • (false|void) False on WordPress error.
Defined at:
Codex:

Display the terms in a list.



Source

function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
	$term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after );

	if ( is_wp_error( $term_list ) ) {
		return false;
	}

	/**
	 * Filters the list of terms to display.
	 *
	 * @since 2.9.0
	 *
	 * @param array  $term_list List of terms to display.
	 * @param string $taxonomy  The taxonomy name.
	 * @param string $before    String to use before the terms.
	 * @param string $sep       String to use between the terms.
	 * @param string $after     String to use after the terms.
	 */
	echo apply_filters( 'the_terms', $term_list, $taxonomy, $before, $sep, $after );
}