Title: WP_Posts_List_Table::get_columns
Published: April 25, 2014
Last modified: February 24, 2026

---

# WP_Posts_List_Table::get_columns(): string[]

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_posts_list_table/get_columns/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_posts_list_table/get_columns/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/wp_posts_list_table/get_columns/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/wp_posts_list_table/get_columns/?output_format=md#related)

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

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_posts_list_table/get_columns/?output_format=md#return)󠁿

 string[] Array of column titles keyed by their column name.

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

    ```php
    public function get_columns() {
    	$post_type = $this->screen->post_type;

    	$posts_columns = array();

    	$posts_columns['cb'] = '<input type="checkbox" />';

    	/* translators: Posts screen column name. */
    	$posts_columns['title'] = _x( 'Title', 'column name' );

    	if ( post_type_supports( $post_type, 'author' ) ) {
    		$posts_columns['author'] = __( 'Author' );
    	}

    	$taxonomies = get_object_taxonomies( $post_type, 'objects' );
    	$taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' );

    	/**
    	 * Filters the taxonomy columns in the Posts list table.
    	 *
    	 * The dynamic portion of the hook name, `$post_type`, refers to the post
    	 * type slug.
    	 *
    	 * Possible hook names include:
    	 *
    	 *  - `manage_taxonomies_for_post_columns`
    	 *  - `manage_taxonomies_for_page_columns`
    	 *
    	 * @since 3.5.0
    	 *
    	 * @param string[] $taxonomies Array of taxonomy names to show columns for.
    	 * @param string   $post_type  The post type.
    	 */
    	$taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type );
    	$taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );

    	foreach ( $taxonomies as $taxonomy ) {
    		if ( 'category' === $taxonomy ) {
    			$column_key = 'categories';
    		} elseif ( 'post_tag' === $taxonomy ) {
    			$column_key = 'tags';
    		} else {
    			$column_key = 'taxonomy-' . $taxonomy;
    		}

    		$posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
    	}

    	$post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';

    	if ( post_type_supports( $post_type, 'comments' )
    		&& ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true )
    	) {
    		$posts_columns['comments'] = sprintf(
    			'<span class="vers comment-grey-bubble" title="%1$s" aria-hidden="true"></span><span class="screen-reader-text">%2$s</span>',
    			esc_attr__( 'Comments' ),
    			/* translators: Hidden accessibility text. */
    			__( 'Comments' )
    		);
    	}

    	$posts_columns['date'] = __( 'Date' );

    	if ( 'page' === $post_type ) {

    		/**
    		 * Filters the columns displayed in the Pages list table.
    		 *
    		 * @since 2.5.0
    		 *
    		 * @param string[] $posts_columns An associative array of column headings.
    		 */
    		$posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
    	} else {

    		/**
    		 * Filters the columns displayed in the Posts list table.
    		 *
    		 * @since 1.5.0
    		 *
    		 * @param string[] $posts_columns An associative array of column headings.
    		 * @param string   $post_type     The post type slug.
    		 */
    		$posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
    	}

    	/**
    	 * Filters the columns displayed in the Posts list table for a specific post type.
    	 *
    	 * The dynamic portion of the hook name, `$post_type`, refers to the post type slug.
    	 *
    	 * Possible hook names include:
    	 *
    	 *  - `manage_post_posts_columns`
    	 *  - `manage_page_posts_columns`
    	 *
    	 * @since 3.0.0
    	 *
    	 * @param string[] $posts_columns An associative array of column headings.
    	 */
    	return apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
    }
    ```

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

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/wp_posts_list_table/get_columns/?output_format=md#hooks)󠁿

 [apply_filters( ‘manage_pages_columns’, string[] $posts_columns )](https://developer.wordpress.org/reference/hooks/manage_pages_columns/)

Filters the columns displayed in the Pages list table.

 [apply_filters( ‘manage_posts_columns’, string[] $posts_columns, string $post_type )](https://developer.wordpress.org/reference/hooks/manage_posts_columns/)

Filters the columns displayed in the Posts list table.

 [apply_filters( “manage_taxonomies_for_{$post_type}_columns”, string[] $taxonomies, string $post_type )](https://developer.wordpress.org/reference/hooks/manage_taxonomies_for_post_type_columns/)

Filters the taxonomy columns in the Posts list table.

 [apply_filters( “manage_{$post_type}_posts_columns”, string[] $posts_columns )](https://developer.wordpress.org/reference/hooks/manage_post_type_posts_columns/)

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

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

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

Retrieves the translation of $text and escapes it for safe use in an attribute.

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

Filters a list of objects, based on a set of key => value arguments.

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

Returns the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name.

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

Checks a post type’s support for a given feature.

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

Retrieves translated string with gettext context.

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

Retrieves the translation of $text.

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

Retrieves the taxonomy object of $taxonomy.

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

Calls the callback functions that have been added to a filter hook.

  |

[Show 4 more](https://developer.wordpress.org/reference/classes/wp_posts_list_table/get_columns/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_posts_list_table/get_columns/?output_format=md#)

## User Contributed Notes

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