manage_posts_custom_column WordPress Action Hook

The manage_posts_custom_column hook allows you to add custom columns to the manage posts screen. This hook is triggered when the manage_posts_custom_column action is called.

do_action( 'manage_posts_custom_column', string $column_name, int $post_id ) #

Fires in each custom column in the Posts list table.


Description

This hook only fires if the current post type is non-hierarchical, such as posts.


Top ↑

Parameters

$column_name

(string)The name of the column to display.

$post_id

(int)The current post ID.


Top ↑

More Information

Combined with the manage_{$post_type}_posts_columns filter, this allows you to add or remove (unset) custom columns to the list post/page/custom post type pages (which automatically appear in Screen Options). The action described in here works both for built in post types as well as custom post types. manage_{$post->$post_type}_posts_custom_column can be used in WP 3.1 and later for specific custom post types. Note that if the custom post type has 'hierarchical' => true, then the correct action hook to use is manage_pages_custom_column.

Predefined Column Names:

The following column filters are already defined and used by WordPress. These can be redefined within a custom filter switch statement.

cb‘: checkbox for selecting post items for bulk actions
title‘: displays the post title as well as post action links (edit, quick edit, trash, view) based on user permissions
author‘: displays the username of the post author as a link to filter post by author
categories‘: displays the post categories as links to filter post by category
tags‘: displays the post tags as links to filter post by tags
comments‘: displays a comment icon with the number of comments as a permalink to manage the comments for that post
date‘: displays the date and status of the post


Top ↑

Source

File: wp-admin/includes/class-wp-posts-list-table.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.