get_question_id()

Description #

Get current question ID in single question page.

Changelog #

VersionDescription
unknownunknown
4.1.0Introduced.

Source #

File: includes/functions.php

function get_question_id() {
	if ( is_question() && get_query_var( 'question_id' ) ) {
		return (int) get_query_var( 'question_id' );
	}

	if ( is_question() ) {
		return get_queried_object_id();
	}

	if ( get_query_var( 'edit_q' ) ) {
		return get_query_var( 'edit_q' );
	}

	if ( ap_answer_the_object() ) {
		return ap_get_post_field( 'post_parent' );
	}

	return false;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Add your comment