sfw_get_primary_term

Description

Retrieve the first term of taxonomy assocciated with a post

Since: 1.0.0

Code

<?php function sfw_get_primary_term( $taxonomy, $post = false ){ 
	 … 
 } ?>

Parameter

$taxonomy
(string) - a valid taxonomy name
$post_id
(string) - post id or WP_Post

Return

(bool|WP_Term) WP_Term or false if none is connected with the post

File

core/includes/functions-wp-helpers.php