Jul
29
2020

Disabling the Post content type in WordPress

WordPress website header - WP logo

Do you need to disable the Post content type in WordPress? Here’s our guide to removing Posts from your WordPress website.

The Post content type in WordPress is one of the defaults that comes with every installation of WordPress, with the other content type being Page.

The difference between WordPress Posts and Pages

The difference between the Post and Page content types boils down to time: content which is “evergreen” or “timeless” is best as a page (e.g., “About us”, “What we do”) – the content may change over time, but its purpose doesn’t, and this sort of content doesn’t have any time sensitivity – it doesn’t really matter if you created the page in 2006 or 2020! Posts, on the other hand, are time-sensitive, and are best used for news articles (e.g., “ABC Inc recognised in global awards”)

Why disable the Post content type?

There are a few scenarios in which removing, or disabling the default Post content type that comes with WordPress is of use. The most common reason is probably that you are building a simple “brochure” style website, and have no need to use Posts.

Of course, you could just ignore the Post content type entirely, but removing it from WordPress is a smoother way to achieve this – and could prevent your web design agency clients confusing where they need to add and edit content in their own website!

Hide Posts from WordPress administration

One way to remove Posts from WordPress is to hide any mention of it in the WordPress administration panel; this doesn’t remove or disable the functionality, but rather just hides the ability of logged in users to see it. You can achieve this by adding the following code to your WordPress theme’s functions.php file:

// Remove default Post content type from WordPress

add_action('admin_menu','remove_posts_type' );
add_action('admin_bar_menu','remove_posts_from_menu', 9999);
add_action('wp_dashboard_setup', 'remove_posts_quickdraft', 9999);

function remove_posts_type() { // Remove post type links
  remove_menu_page('edit.php');
}
function remove_posts_quickdraft(){ // Remove "quick drafts" post from dashboard
  remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); 
}
function remove_posts_from_menu( $wp_admin_bar ) { // Remove "New post" links
  $wp_admin_bar->remove_node('new-post');
}

This removes links to Posts from your WordPress administration panel, as well as the “quick draft” block from the dashboard. There is also the possiblity you can remove the ability to add, edit or view posts from specific user roles (e.g., Editor, Subscriber, Administrator) by customising WordPress’ default roles and permissions.

You can also use WordPress’ remove_post_type_support function to disable particular features for content types in your website. For example, if you want to remove support for excerpts from your posts, you can add the following to your theme’s functions.php file in the wp-content/themes/ directory.

Finally, you may also find our guide to remove custom post types from Yoast’s SEO sitemap helpful.

Still need help with your WordPress website? Check out WordPress support from RCC, or our WordPress consultancy services.