Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_the_first_term( $post_id , $taxonomy , $property = '' ){
- $terms = wp_get_post_terms( $post_id , $taxonomy );
- if ( is_wp_error( $terms ) || empty( $terms ) ) return 0;
- if ( ! $property ) return $terms[0];
- return $terms[0]->$property;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement