do_action( "manage_{$post->post_type}_posts_custom_column", string $column_name, int $post_id )

Fires for each custom column of a specific post type in the Posts list table.

Description Description

The dynamic portion of the hook name, $post->post_type, refers to the post type.

Top ↑

Parameters Parameters


(string) The name of the column to display.


(int) The current post ID.

Top ↑

Source Source

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

View on Trac

Top ↑

Changelog Changelog

Version Description
3.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Andrija Naglic
    // let's say we have a CPT called 'product'
    function product_custom_column_values( $column, $post_id ) {
        switch ( $column ) {
    		// in this example, a Product has custom fields called 'product_number' and 'product_name'
            case 'product_number'	:
            case 'product_name' 	:
                echo get_post_meta( $post_id , $column , true );
    		// in this example, $buyer_id is post ID of another CPT called "buyer"
            case 'product_buyer' 	:
                $buyer_id = get_post_meta( $post_id , $column , true );
                if( $buyer_id ){
                    echo get_post_meta( $buyer_id , 'buyer_name' , true );
                } else {
                    echo '<div class="dashicons dashicons-minus"></div>';
    add_action( 'manage_product_posts_custom_column' , 'product_custom_column_values', 10, 2 );

    For further management of columns, check:
    To add/remove/rename columns
    To set the primary (default) column

You must log in before being able to contribute a note or feedback.