When admin creates a post with five custom fields I creates 5 posts with post_parent id to main post. But these 5 posts are also showing in posts listing table which I want to hide.
In /wp-admin/edit.php where wordpress shows all posts (parent & child) under All/Publish I want to show only Parent posts having post_type = post because I am using other post types as well but only want to change view where post_type = post.
I knows for this I must need to edit core file, no matter I can. After searching in wp-admin/includes/class-wp-list-table.php
I found
/**
* Generate the <tbody> part of the table
*
* @since 3.1.0
* @access protected
*/
function display_rows_or_placeholder() {
if ( $this->has_items() ) {
$this->display_rows();
} else {
list( $columns, $hidden ) = $this->get_column_info();
echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
$this->no_items();
echo '</td></tr>';
}
}
which creates rows for posts list table but I can not found where to set condition & custom query :
IF (post_type == 'post'){
// list only parent posts
}else{
// do default behavior
}
I searched almost 3hrs but no solution found. Okay if it is not possible then can we show same Hierarchy for posts like for Pages parent/child relation.
After approx 4hrs research I found wordpress: how to add hierarchy to posts
which seem that wordpress need to implement such feature.