apply_filters( "manage_{$post_type}_posts_columns", string[] $post_columns )

Filters the columns displayed in the Posts list table for a specific post type.


Description Description

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


Top ↑

Parameters Parameters

$post_columns

(string[]) An associative array of column headings.


Top ↑

Source Source

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

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Andrija Naglic
    function my_custom_columns_list($columns) {
        
        unset( $columns['title']  );
        unset( $columns['author'] );
        unset( $columns['date']   );
        
        $columns['product_number']     = 'Product Number';
        $columns['custom_handler']     = 'Nice name';
    
    	
        return $columns;
    }
    add_filter( 'manage_product_posts_columns', 'my_custom_columns_list' );
    

    For further management of columns, check:

    https://developer.wordpress.org/reference/hooks/manage_post-post_type_posts_custom_column/
    To set the custom column values

    https://developer.wordpress.org/reference/hooks/list_table_primary_column/
    To set the primary (default) column

  2. Skip to note 2 content
    Contributed by kantbtrue

    To reorder columns

    function wpdocs_item_columns( $columns ) {
        $custom_col_order = array(
            'cb' => $columns['cb'],
            'title' => $columns['title'],
            'rating' => __( 'Ratings', 'textdomain' ),
            'date' => $columns['date']
        );
        return $custom_col_order;
    }
    add_filter( 'manage_item_posts_columns', 'wpdocs_item_columns' );
    

    Just use the $custom_col_order array to reorder the columns in {$post_type}.
    NOTE: in the above example, item is the custom post type

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