ap_count_published_answers( integer $question_id )

Description #

Return numbers of published answers.

Parameters #

  • $question_id
    integer (Required) Question ID.

Source #

File: includes/answer-loop.php

function ap_count_published_answers( $question_id ) {
	global $wpdb;
	$query = $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->posts where post_parent = %d AND post_status = %s AND post_type = %s", $question_id, 'publish', 'answer' );

	$count = $wpdb->get_var( $query ); // phpcs:ignore WordPress.DB

	return $count;
}

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