WordPress was originally a blogging platform which are made up of “posts”. But not every WordPress site is a blog site that contain posts. In fact, over half of the websites we design do not include any blog / posts. We prefer to keep the Admin and Dashboard area as clean as possible not only for ourselves, but also for our clients. It helps me when logging into one of our managed sites to instantly know whether the site contains a blog or not if I see or not see the infamous “Posts” in the sidebar. It also limits possible confusion with our clients as unused functions are out of sight, out of mind. We’ve had to explain what the “Posts” button means to plenty of clients with blogless sites. This post explains how to remove the “post” post type from the backend / admin area all together.
To remove posts from your WordPress site, add this code to your child theme’s functions.php file. (It’s always recommended to use a Child Theme as soon as you start doing any customization of your site files/functionality)
// ************* Remove default Posts type since no blog ************* | |
// Remove side menu | |
add_action( ‘admin_menu’, ‘remove_default_post_type’ ); | |
function remove_default_post_type() { | |
remove_menu_page( ‘edit.php’ ); | |
} | |
// Remove +New post in top Admin Menu Bar | |
add_action( ‘admin_bar_menu’, ‘remove_default_post_type_menu_bar’, 999 ); | |
function remove_default_post_type_menu_bar( $wp_admin_bar ) { | |
$wp_admin_bar->remove_node( ‘new-post’ ); | |
} | |
// Remove Quick Draft Dashboard Widget | |
add_action( ‘wp_dashboard_setup’, ‘remove_draft_widget’, 999 ); | |
function remove_draft_widget(){ | |
remove_meta_box( ‘dashboard_quick_press’, ‘dashboard’, ‘side’ ); | |
} | |
// End remove post type |
view rawwp-remove-posts-type hosted with ❤ by GitHub
The above code removes the “post” functionality from:
- Sidebar Menu
- The top +New dropdown menu
- The dashboard “Quick Draft” widget
By Blake Miller|WordPress Tips, WordPress|6 Comments
About the Author: Blake Miller
Blake Miller is the Founder, Owner and Creative Director of MITO Studios with over 22 years of Design, Marketing, Communications and Business Operations & Management experience. MITO Studios has helped countless Individuals, Entrepreneurs, Small Businesses and Organizations operate more efficiently while improving their marketing, communications making it easier to attract and retain customers.
6 Comments
- Davide De Maestri February 15, 2022 at 6:11 am – ReplyThank you, still valid and useful!
- Fred August 26, 2021 at 4:51 am – ReplyThanks! Very nice.How about “settings/read/posts page” and “Appearance/customize/settings for front page/posts page”?Sorry if the translation is not correct!Best RegardsFred
- Andre April 28, 2021 at 9:58 am – ReplyAwesome code snippet! Thanks!
- Jay April 27, 2021 at 10:49 am – ReplyI can’t believe I’m just now finding this. Thank you so much Blake for posting this. This has helped me out a lot.
- Joel September 2, 2020 at 3:19 am – ReplyThanks Blake. This is exactly what I was looking to do as I also want a clean UI for my client. It will help them, and ultimately me as well, as it’s one less potential confusion point that I will not need to train around.
source : https://www.mitostudios.com/blog/how-to-remove-posts-blog-post-type-from-wordpress/#