ap_get_question( integer $question_id )

Description #

Get an question by ID.

Parameters #

  • $question_id
    integer (Required) Question ID.

Changelog #

VersionDescription
2.1Introduced.

Source #

File: includes/question-loop.php

function ap_get_question( $question_id ) {
	$args = array(
		'p'           => $question_id,
		'ap_query'    => 'single_question',
		'post_status' => array( 'publish' ),
	);

	if ( ap_user_can_view_future_post( $question_id ) ) {
		$args['post_status'][] = 'future';
	}

	if ( ap_user_can_view_private_post( $question_id ) ) {
		$args['post_status'][] = 'private_post';
	}

	if ( ap_user_can_view_moderate_post( $question_id ) ) {
		$args['post_status'][] = 'moderate';
	}

	return new Question_Query( $args );
}

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