Created
February 17, 2015 03:41
-
-
Save designbuildtest/cb48bf5b32d362baaf46 to your computer and use it in GitHub Desktop.
Exclude Homepage from main Admin query
This file contains hidden or 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
| function exclude_this_page( $query ) { | |
| if( ! is_admin() ) | |
| return $query; | |
| global $pagenow; | |
| if( 'edit.php' == $pagenow && ( get_query_var( 'post_type' ) && 'page' == get_query_var( 'post_type' ) ) ) | |
| $query->set( 'post__not_in', array(2) ); // Change '2' to the ID of your Homepage | |
| return $query; | |
| } | |
| add_action( 'pre_get_posts' ,'exclude_this_page' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment