Created
December 31, 2014 20:44
-
-
Save tylerdigital/7ae063f8c3630e88f61c to your computer and use it in GitHub Desktop.
Hide children posts in admin index for hierarchical WordPress posts
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
add_action( 'pre_get_posts', array( $this, 'hide_children_posts' ) ); | |
function hide_children_posts( $query ) { | |
if ( !is_post_type_archive( 'hotspot' ) || !is_admin() ) return; | |
$query->set( 'post_parent', 0 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment