ap_get_post( mixed $post = null )

Description #

Get posts with qameta fields.

Parameters #

  • $post
    mixed (Optional) Post object. Default value: null

Source #

File: includes/qaquery.php

function ap_get_post( $post = null ) {
	if ( empty( $post ) && isset( $GLOBALS['post'] ) ) {
		$post = $GLOBALS['post']; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
	}

	if ( $post instanceof WP_Post || is_object( $post ) ) {
		$_post = $post;
	} else {
		$_post = WP_Post::get_instance( $post );
	}

	if ( $_post && ! isset( $_post->ap_qameta_wrapped ) ) {
		$_post = ap_append_qameta( $_post );
	}

	return $_post;
}

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