Parent Page Column for Pages
Adds a Parent column to the Pages list with a link to each page's parent, so the structure of a large site is clear even when the list is sorted or searched.
Opens WPIDE on
Code
add_filter( 'manage_page_posts_columns', function ( $columns ) {
$columns['wpide_parent'] = 'Parent';
return $columns;
} );
add_action( 'manage_page_posts_custom_column', function ( $column, $post_id ) {
if ( 'wpide_parent' !== $column ) {
return;
}
$parent = (int) wp_get_post_parent_id( $post_id );
if ( ! $parent ) {
echo '–';
return;
}
printf( '<a href="%s">%s</a>', esc_url( get_edit_post_link( $parent ) ), esc_html( get_the_title( $parent ) ) );
}, 10, 2 );
Notes
Top-level pages show a dash.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.