Skip to content

Instantly share code, notes, and snippets.

@tylerdigital
Created December 31, 2014 20:44
Show Gist options
  • Save tylerdigital/7ae063f8c3630e88f61c to your computer and use it in GitHub Desktop.
Save tylerdigital/7ae063f8c3630e88f61c to your computer and use it in GitHub Desktop.
Hide children posts in admin index for hierarchical WordPress posts
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