WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/manage pages custom column

Description

Combined with the manage_pages_columns filter, this allows you to add custom columns to the list page pages. Note that if you are using custom post types and it has 'hierarchical' => true, then you will need to use this action hook and not manage_$post_type_posts_custom_column.

Parameters

A registered action function is passed the following parameters.

$column_name 
(string) (required) The name of the column to display.

Default: None

$post_id 
(int) (required) The ID of the current post. Can also be taken from the global $post->ID.

Default: None

Examples

Once you have added your column (for this example, thumbnail), we are now going to set the featured image to display for that page in the new thumbnail column.

function custom_page_column_content( $column_name, $post_id ) {
	if ( $column_name == 'thumbnail' ) {
		$post_thumbnail_id = get_post_thumbnail_id( $post_id );
		if ( $post_thumbnail_id ) {
			$post_thumbnail_img = wp_get_attachment_image_src( $post_thumbnail_id, 'thumbnail' );
			echo '<img src="' . $post_thumbnail_img[0] . '" />';
		}
	}
}

add_action( 'manage_pages_custom_column', 'custom_page_column_content', 10, 2 );
This page is marked as incomplete. You can help Codex by expanding it.