Created
March 4, 2014 20:59
-
-
Save germanny/9355517 to your computer and use it in GitHub Desktop.
get page parent in wp-admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ; | |
$parents = get_post_ancestors( $post_id ); | |
$id = ($parents) ? $parents[count($parents)-1]: $post_id; | |
$parent = get_page( $id ); | |
if ( get_id_by_page_name('states') == $parent->ID ) { | |
// do stuff | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment