In WordPress how to remove columns from page or post or custom post type screen

WordPress users may edit the columns that appear on the post or page screen. But, in order to simplify the screen or eliminate unneeded information, certain columns may need to be removed.

There are two ways you can remove columns

1. Using default WordPress UI
2. Using code

1. Using default WordPress UI

Step 1: Go to the post or page screen

Log in to your WordPress dashboard and navigate to the “Posts” or “Pages” section in the left-hand menu.

Step 2: Click on the “Screen Options” button

Click on the “Screen Options” button in the top-right corner of the screen. This will display a drop-down menu with options to customize the columns displayed on the screen.

Step 3: Uncheck the columns you want to remove

Uncheck the boxes next to the columns you want to remove. You can remove multiple columns at once.

Step 4: Click on the “Apply” button

After unchecking the boxes next to the columns you want to remove, click on the “Apply” button at the bottom of the screen. The post or page screen will refresh, and the columns you unchecked will no longer be displayed.

If you want to add columns back to the post or page screen, simply repeat the process and check the boxes next to the columns you want to display.

2. Using code

If you want to remove columns from the post or page screen in WordPress using code, you can do so by adding a function to your theme’s functions.php file or a custom plugin.

Here’s an example of how to remove the “Author” and “Comments” columns from the post screen in WordPress using code:

function remove_post_columns( $columns ) {
    unset( $columns['author'] );
    unset( $columns['comments'] );
    return $columns;
}
add_filter( 'manage_post_posts_columns', 'remove_post_columns' );

Let’s break down this code:

  • The remove_post_columns() function takes an array of column names as its parameter.
  • The unset() function is used to remove the “Author” and “Comments” columns from the array.
  • The modified array is returned using the return statement.
  • The add_filter() function is used to add the remove_post_columns() function to the manage_post_posts_columns filter, which is used to modify the columns displayed on the post screen in WordPress.

You can modify this code to remove other columns from the post or page screen by changing the column names passed to the unset() function.

In WordPress, the post types ‘Post’ and ‘Page’ are built-in. You may view it on your Page listing’s URL wp-admin/edit.php?post type=post or wp-admin/edit.php?post type=page. Take note of the post type=post or post type=page in the URL. If you wish to remove columns from the Page listing, use the manage_page_posts_columns filter.

In the case of a custom post type, you must use the filter manage_{$post_type}_posts_custom_column, where {$post_type} is a placeholder for the actual post type name.

Removing columns from the post or page screen in WordPress using the default UI or code is a straightforward process. By following the steps or example code provided in this guide, you can easily remove columns from the post or page screen in WordPress to meet your specific needs.

If you want to add columns in post or page or custom post type screen, you can read this article.

Leave a Comment

Your email address will not be published. Required fields are marked *