A_Z_Listing::find_post_parent( WP_Post|int $page )

Find a post’s parent post. Will return the original post if the post-type is not hierarchical or the post does not have a parent.


Description


Parameters

$page

(WP_Post|int) (Required) The post whose parent we want to find.


Return

(WP_Post|bool) The parent post or the original post if no parents were found. Will be false if the function is called with incorrect arguments.


Source

File: classes/class-a-z-listing.php

	public static function find_post_parent( $page ) {
		if ( ! $page ) {
			return false;
		}
		if ( ! $page instanceof WP_Post ) {
			$page = get_post( $page );
		}
		if ( ! $page->post_parent ) {
			return $page;
		}
		return self::find_post_parent( $page->post_parent );
	}

Changelog

Changelog
VersionDescription
1.4.0Introduced.

More Information

You are currently logged out. To view tickets you must first login.

I have read and understood the Terms of Service



User Contributed Notes

Leave a Reply

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