Are you looking for a way to easily remove columns from the posts and pages? While there’s probably a plugin for this, we have created a quick code snippet that you can use to remove post columns in WordPress. In this case, it will remove the Comments column.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
function remove_post_columns($defaults) { unset($defaults['comments']); return $defaults; } add_filter('manage_posts_columns', 'remove_post_columns');
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 11 best WordPress slider plugins and how to increase maximum file upload size in WordPress.
[…] Similar to the snippet above, this code will remove columns from the posts page. Source […]
[…] "do_googleMaps");* * *Recent Posts With Thumbnails In WordPress Without A Plugin* * *Remove post columns1 2 3 4 5 function remove_post_columns($defaults) { […]
[…] Similar to the snippet above, this code will remove columns from the posts page. Source […]
Thanks for this snippit! I use this on custom post types overviews to remove custom posts column i set for posts with ‘manage_posts_columns’. But isn’t there a better way to set custom columns ONLY for the post overview?
You can add custom post type columns using this method,
http://wpsnipp.com/index.php/functions-php/add-featured-thumbnail-to-admin-post-columns/
[…] return $defaults; } add_filter('manage_posts_columns', 'remove_post_columns');Source →Removing Default Widgets from the DashboardThe majority of the default Dashboard widgets may not be […]