Title: WP_List_Table::single_row_columns
Published: April 25, 2014
Last modified: February 24, 2026

---

# WP_List_Table::single_row_columns( object|array $item )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#parameters)
 * [More Information](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#wp--skip-link--target)

Generates the columns for a single row of the table.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#parameters)󠁿

 `$item`object|arrayrequired

The current item.

## 󠀁[More Information](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#more-information)󠁿

This renders out all the columns for a single item row. It is important to understand
that this method assumes the existence of some custom column methods (eg column_mycolumn())
and/or a **column_default()** method. Neither of these are provided by the base 
class and should be defined in your extended class. Generally, you don’t need to
call this explicitly as it is handled automatically on display().

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#source)󠁿

    ```php
    protected function single_row_columns( $item ) {
    	list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();

    	foreach ( $columns as $column_name => $column_display_name ) {
    		$classes = "$column_name column-$column_name";
    		if ( $primary === $column_name ) {
    			$classes .= ' has-row-actions column-primary';
    		}

    		if ( in_array( $column_name, $hidden, true ) ) {
    			$classes .= ' hidden';
    		}

    		/*
    		 * Comments column uses HTML in the display name with screen reader text.
    		 * Strip tags to get closer to a user-friendly string.
    		 */
    		$data = 'data-colname="' . esc_attr( wp_strip_all_tags( $column_display_name ) ) . '"';

    		$attributes = "class='$classes' $data";

    		if ( 'cb' === $column_name ) {
    			echo '<th scope="row" class="check-column">';
    			echo $this->column_cb( $item );
    			echo '</th>';
    		} elseif ( method_exists( $this, '_column_' . $column_name ) ) {
    			echo call_user_func(
    				array( $this, '_column_' . $column_name ),
    				$item,
    				$classes,
    				$data,
    				$primary
    			);
    		} elseif ( method_exists( $this, 'column_' . $column_name ) ) {
    			echo "<td $attributes>";
    			echo call_user_func( array( $this, 'column_' . $column_name ), $item );
    			echo $this->handle_row_actions( $item, $column_name, $primary );
    			echo '</td>';
    		} else {
    			echo "<td $attributes>";
    			echo $this->column_default( $item, $column_name );
    			echo $this->handle_row_actions( $item, $column_name, $primary );
    			echo '</td>';
    		}
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-wp-list-table.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/class-wp-list-table.php#L1761)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/class-wp-list-table.php#L1761-L1806)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_List_Table::handle_row_actions()](https://developer.wordpress.org/reference/classes/wp_list_table/handle_row_actions/)`wp-admin/includes/class-wp-list-table.php` |

Generates and display row actions links for the list table.

  | 
| [WP_List_Table::column_cb()](https://developer.wordpress.org/reference/classes/wp_list_table/column_cb/)`wp-admin/includes/class-wp-list-table.php` |  | 
| [WP_List_Table::column_default()](https://developer.wordpress.org/reference/classes/wp_list_table/column_default/)`wp-admin/includes/class-wp-list-table.php` |  | 
| [WP_List_Table::get_column_info()](https://developer.wordpress.org/reference/classes/wp_list_table/get_column_info/)`wp-admin/includes/class-wp-list-table.php` |

Gets a list of all, hidden, and sortable columns, with filter applied.

  | 
| [wp_strip_all_tags()](https://developer.wordpress.org/reference/functions/wp_strip_all_tags/)`wp-includes/formatting.php` |

Properly strips all HTML tags including ‘script’ and ‘style’.

  | 
| [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)`wp-includes/formatting.php` |

Escaping for HTML attributes.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#)

| Used by | Description | 
| [WP_List_Table::single_row()](https://developer.wordpress.org/reference/classes/wp_list_table/single_row/)`wp-admin/includes/class-wp-list-table.php` |

Generates content for a single row of the table.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_list_table/single_row_columns/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_list_table%2Fsingle_row_columns%2F)
before being able to contribute a note or feedback.