Title: WP_List_Table::print_table_description
Published: August 8, 2023
Last modified: February 24, 2026

---

# WP_List_Table::print_table_description()

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_list_table/print_table_description/?output_format=md#description)
 * [Source](https://developer.wordpress.org/reference/classes/wp_list_table/print_table_description/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_list_table/print_table_description/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_list_table/print_table_description/?output_format=md#changelog)

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

Print a table description with information about current sorting and order.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_list_table/print_table_description/?output_format=md#description)󠁿

For the table initial view, information about initial orderby and order should be
provided via get_sortable_columns().

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

    ```php
    public function print_table_description() {
    	list( $columns, $hidden, $sortable ) = $this->get_column_info();

    	if ( empty( $sortable ) ) {
    		return;
    	}

    	// When users click on a column header to sort by other columns.
    	if ( isset( $_GET['orderby'] ) ) {
    		$current_orderby = $_GET['orderby'];
    		// In the initial view there's no orderby parameter.
    	} else {
    		$current_orderby = '';
    	}

    	// Not in the initial view and descending order.
    	if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) {
    		$current_order = 'desc';
    	} else {
    		// The initial view is not always 'asc', we'll take care of this below.
    		$current_order = 'asc';
    	}

    	foreach ( array_keys( $columns ) as $column_key ) {

    		if ( isset( $sortable[ $column_key ] ) ) {
    			$orderby       = isset( $sortable[ $column_key ][0] ) ? $sortable[ $column_key ][0] : '';
    			$desc_first    = isset( $sortable[ $column_key ][1] ) ? $sortable[ $column_key ][1] : false;
    			$abbr          = isset( $sortable[ $column_key ][2] ) ? $sortable[ $column_key ][2] : '';
    			$orderby_text  = isset( $sortable[ $column_key ][3] ) ? $sortable[ $column_key ][3] : '';
    			$initial_order = isset( $sortable[ $column_key ][4] ) ? $sortable[ $column_key ][4] : '';

    			if ( ! is_string( $orderby_text ) || '' === $orderby_text ) {
    				return;
    			}
    			/*
    			 * We're in the initial view and there's no $_GET['orderby'] then check if the
    			 * initial sorting information is set in the sortable columns and use that.
    			 */
    			if ( '' === $current_orderby && $initial_order ) {
    				// Use the initially sorted column $orderby as current orderby.
    				$current_orderby = $orderby;
    				// Use the initially sorted column asc/desc order as initial order.
    				$current_order = $initial_order;
    			}

    			/*
    			 * True in the initial view when an initial orderby is set via get_sortable_columns()
    			 * and true in the sorted views when the actual $_GET['orderby'] is equal to $orderby.
    			 */
    			if ( $current_orderby === $orderby ) {
    				/* translators: Hidden accessibility text. */
    				$asc_text = __( 'Ascending.' );
    				/* translators: Hidden accessibility text. */
    				$desc_text  = __( 'Descending.' );
    				$order_text = 'asc' === $current_order ? $asc_text : $desc_text;
    				echo '<caption class="screen-reader-text">' . $orderby_text . ' ' . $order_text . '</caption>';

    				return;
    			}
    		}
    	}
    }
    ```

[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#L1544)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/class-wp-list-table.php#L1544-L1606)

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

| Uses | Description | 
| [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.

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

Retrieves the translation of $text.

  |

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

Displays the table.

  |

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

| Version | Description | 
| [6.3.0](https://developer.wordpress.org/reference/since/6.3.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%2Fprint_table_description%2F)
before being able to contribute a note or feedback.