I created a custom post type called "Companies". Every time a post of post type companies is created, a child post is also created.
I would like to hide the child posts of this companies post type in the backend. Is there a way to do this?
Thanks!
I managed to do this by using the following code:
function cleanup_companies_posttype_list($query) {
global $pagenow;
if (isset($_GET['post_type']) && $_GET['post_type'] == 'companies' && $pagenow == 'edit.php') {
$query->set('post_parent',0);
}
}
add_filter('pre_get_posts', 'cleanup_companies_posttype_list');