WP_List_Table::column_default() WordPress Method

The WP_List_Table::column_default() method is used to render the default column content for a particular row. This is typically the value of a field from the database record for the given row. In most cases, the default column content will suffice. However, there may be occasions when you need to customize the column content. For example, you may want to display a post thumbnail instead of the post title. The column_default() method accepts two arguments: the current row object and the name of the column. Here is an example of how to override the default column content: function my_custom_column_content( $post, $column_name ) { if ( 'thumbnail' === $column_name ) { the_post_thumbnail( 'my-custom-size' ); } else { echo get_post_meta( $post->ID, $column_name, true ); } } add_filter( 'manage_posts_custom_column', 'my_custom_column_content', 10, 2 );

WP_List_Table::column_default( object|array $item, string $column_name ) #


Parameters

$item

(object|array)(Required)

$column_name

(string)(Required)


Top ↑

More Information

This is method that is used to render a column when no other specific method exists for that column. When WP_List_Tables attempts to render your columns (within single_row_columns()), it first checks for a column-specific method. If none exists, it defaults to this method instead. This method accepts two arguments, a single $item array and the $column_name (as a slug).
NOTICE: As of WordPress 3.5.1, in core $item is passed an Object, not an array.

Top ↑

Source

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

	protected function column_default( $item, $column_name ) {}

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.