Return to Snippet

Revision: 31374
at September 3, 2010 18:31 by levinet


Initial Code
function get_parent_page() {
	global $post;
	$topParent = $post;
	while ($topParent->post_parent) {
		$topParent = $topParent->post_parent;
	}
	return get_page($topParent);
}

Initial URL

                                

Initial Description
Returns the page object of the parent of the current page.

Initial Title
WordPress - Get Current Page Parent

Initial Tags
php, page, wordpress

Initial Language
PHP