Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14776 closed defect (bug) (fixed)

'manage_' . screen . '_columns' filter not working

Reported by: arena Owned by:
Milestone: 3.1 Priority: normal
Severity: major Version:
Component: Administration Keywords:
Focuses: Cc:


in 3.0 i am using this filter to initialize the columns list in order to have them checkable with the "screen options" tab.

in 3.1 this do not work !

Change History (10)

comment:1 scribu4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

As I've said in #14651 (http://core.trac.wordpress.org/ticket/14651#comment:11) you should be using register_column_headers() instead.

comment:2 arena4 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Type changed from defect (bug) to feature request

Ok, but could you give a sample how to use your classes for an admin page plugin (list and page)

thank you

comment:3 scribu4 years ago

  • Resolution set to worksforme
  • Status changed from reopened to closed


Example class:

class Example_List_Table extends WP_List_Table {

	function __construct() {
		parent::WP_List_Table( array(
			'screen' => 'item',
			'plural' => 'items',
		) );

	function prepare_items() {
		$this->items = get_items();

		$this->set_pagination_args( array(
			'total_items' => 100,
			'per_page' => 10
		) );

	function get_columns() {
		return array(
			'cb'    => '<input type="checkbox" />',
			'name'  => 'Name',
			'color' => 'Color',

	function column_cb( $item ) {
		return '<input type="checkbox" name="delete_items[]" value="' . $item->id . '">';

	function column_name( $item ) {
		return $item->name;

	function column_color( $item ) {
		return $item->color;

	function column_default( $item, $column_name ) {
		return apply_filters( "manage_items_custom_column", '', $column_name, $item->id );

How you use it:

function example_init() {
  require dirname(__FILE__) . '/example-list-table.class.php';

  global $wp_list_table;

  $wp_list_table = new Example_List_Table;
add_action('admin_init', 'example_init');

// later...


Mockup get_items() function:

function get_items() {
	$items = array();

	$items[] = (object) array(
		'id' => 1,
		'name' => 'First item',
		'color' => 'red',

	$items[] = (object) array(
		'id' => 2,
		'name' => 'Second item',
		'color' => 'green',

	return $items;

Note: you don't need to re-open the ticket to leave a reply.

comment:4 scribu4 years ago

PS: Make sure you're at least at r15622

comment:5 nacin4 years ago

I'm afraid the loss of this filter will break existing plugins. It'll break mine as far as I can tell.

comment:6 scribu4 years ago

The filter is still there.

It just needs either register_column_headers() or a WP_List_Table instance called first.

comment:7 nacin4 years ago

  • Milestone set to 3.1
  • Resolution worksforme deleted
  • Severity changed from major to blocker
  • Status changed from closed to reopened
  • Type changed from feature request to defect (bug)

Per discussion in IRC.

comment:8 scribu4 years ago

  • Severity changed from blocker to major

As a clarification, this only affects plugins that create completely new tables.

I.e., it still works for tables of posts, comments etc.

comment:9 scribu4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [15653]) Column headers revamp:

  • undeprecate get_column_headers()
  • undeprecate get_hidden_columns()
  • in WP_List_Table, rename get_column_headers() to get_column_info()
  • remove $taxonomy argument from single_row()
  • merge manage_columns_prefs() into screen_meta()

Fixes #14952. Fixes #14776.

comment:10 nacin4 years ago

(In [15662]) Prevent the $title global from being stomped. Caused by merger of manage_columns_prefs() into screen_meta() in [15653]. see #14952, see #14776. The global is apparent cruft as the function doesn't use it.

Note: See TracTickets for help on using tickets.