ap_have_parent_post( boolean|integer $post_id = false )

Description #

Check if question have a parent post.

Parameters #

  • $post_id
    boolean | integer (Optional) question or answer ID. Default value: false

Changelog #

VersionDescription
2.0.0Introduced.

Source #

File: includes/theme.php

function ap_have_parent_post( $post_id = false ) {
	if ( ! $post_id ) {
		$post_id = get_the_ID();
	}

	// Get post.
	$post_o = ap_get_post( $post_id );

	if ( $post_o->post_parent > 0 && 'question' === $post_o->post_type ) {
		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