ap_post_have_terms( boolean|integer $post_id = false, string $taxonomy = 'question_category' )

Description #

Check if post have terms of a taxonomy.

Parameters #

  • $post_id
    boolean | integer (Optional) Post ID. Default value: false
  • $taxonomy
    string (Optional) Taxonomy name. Default value: 'question_category'

Source #

File: includes/qaquery.php

function ap_post_have_terms( $post_id = false, $taxonomy = 'question_category' ) {
	if ( ! $post_id ) {
		$post_id = get_the_ID();
	}

	$terms = get_the_terms( $post_id, $taxonomy );

	if ( ! empty( $terms ) ) {
		return true;
	}

	return false;
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment