Make WordPress Core

Opened 7 years ago

Last modified 3 years ago

#35416 new enhancement

List children pages of another (in dashboard)

Reported by: selnomeria's profile selnomeria Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch
Focuses: ui, administration Cc:


In Dashboard, in "ALL POSTS" page,
there is available to list POSTS of specific categories..

it is good, if such thing was possible for PAGES,
when i have hundreds of pages, then i want to show only specific page's children pages...

please add this posibility (like url :


Attachments (3)

35416.diff (2.6 KB) - added by Shital Patel 4 years ago.
Sorting Pages by parent
patch_for_page_sort_parent.diff (2.6 KB) - added by tazotodua 4 years ago.
35416-2.diff (2.6 KB) - added by tazotodua 4 years ago.

Download all attachments as: .zip

Change History (13)

#1 @swissspidy
7 years ago

  • Component changed from General to Posts, Post Types
  • Focuses ui administration added

#2 @DrewAPicture
6 years ago

Hi @selnomeria, are you saying that you want to add something like parent=### support to the posts list table (used for all post types)? If so, would you be interested in submitting a patch?

#3 @tazotodua
6 years ago

(I am OP selnomeria.. it was my old user).

here is solution.
it's good if you added as a patch, because i am not familiar with adding patch in core myself...

add_action('init', 'parented_posts_initialize',11);
function parented_posts_initialize(){
	$p_types = array('post','page'); //get_post_types()
	$parented_post_types = apply_filters('parented_posts_filter',$p_types );
	foreach($parented_post_types as $each){
		add_filter('manage_edit-'.$each.'_columns', 'create_parented_column');
		add_action('manage_'.$each.'_posts_custom_column', 'parented_column_func', 10, 2 );
		add_filter('manage_edit-'.$each.'_sortable_columns', 'make_parent_column_sortable' );

function create_parented_column($columns) {
    $columns['parents'] =__('parents');
    return $columns;

function parented_column_func( $column_name, $post_id ) {
    if ( 'parents' != $column_name )        return;
    //Get number of parents from post meta
    $parentId = wp_get_post_parent_id( $post_id ) ;
	$parent_p= get_post($parentId);
	if($parentId != $post_id && $parentId !=0){
		$url =  $_SERVER['REQUEST_URI'];
		$url =  add_query_arg('parent_id', $parentId, $url );
		$url =  add_query_arg('orderby', 'parent', $url );
		echo '<a href="'.$url.'">'.$parent_p->post_name.'</a>'; return;
    echo ($finalParent);

function make_parent_column_sortable( $columns ) {
    $columns['parents'] = 'parent';   // to remove:  unset($columns['date']);
    return $columns;

add_action( 'pre_get_posts', 'my_slice_orderby' );
function my_slice_orderby( $query ) {
    if( ! is_admin() )          return;
	global $pagenow;
	if ( ( $pagenow == 'edit.php' ) ) {     // && ( 'slices' == $query->get( 'orderby'))
			$query->set('post_parent', (int) $_GET['parent_id'] );

user can use filter to add his desirable custom filter:

add_filter('parented_posts_filter', 'myparented_fitlers',10,1);
function myparented_fitlers($post_types=array()){
	return array_merge($post_types, array('my_custom_type') );
Last edited 6 years ago by tazotodua (previous) (diff)

#4 @kpegoraro
6 years ago

Yes, we have had this business request, too. One thing that has helped us without this core functionality is to use this CMS Tree Page View plugin: Is that similar to what you wanted, maybe in a different way?

#5 @tazotodua
6 years ago

@kpegoraro I think that solution should be even included in CORE! that will take WP administration of pages/posts into the higher stage.

#6 @SergeyBiryukov
4 years ago

#47739 was marked as a duplicate.

@Shital Patel
4 years ago

Sorting Pages by parent

#7 @tazotodua
4 years ago

I am re-posting from this another topic (which was closed as duplicate for this topic), so I am attaching my patch here (@shital-patel seems you copied my attached patch, thanks, but I have modified it again as Sergey suggested in that topic), and I am also adding screenshots:

Here screenshot -
left side is original, clicking on the parent slug makes the table sorted (as on the right screenshot)

The attached patch is just my approximation, but I doubt that it will need some modification or revision, because I've added "post_parent" in public_query_vars

Last edited 4 years ago by tazotodua (previous) (diff)

4 years ago

#8 @tazotodua
4 years ago

one thing is to review if it's good to be added in public_query_vars or should be hardcoded into wp-query.php file itself.

Last edited 4 years ago by tazotodua (previous) (diff)

#9 @tazotodua
4 years ago

  • Keywords has-patch added

#10 @ttodua
3 years ago

Can someone add this feature? it is already written, just needs to be integrated in correct place.

Last edited 3 years ago by ttodua (previous) (diff)
Note: See TracTickets for help on using tickets.