How to Hide Add New Buttons For a WordPress Specific Custom Post Type on Wp-Admin

Sometimes, when you register a custom post type, you may want to hide “add new” buttons on wp-admin menu and edit page, to keep a fixed number of posts to be managed by the user without changing the original website concept or design.

Just paste the code bellow on your theme functions.php file, and the “add new” buttons will be hidden from wp-admin users.

// hide "add new" on wp-admin menu
function hd_add_box() {
  global $submenu;

// hide "add new" button on edit page
function hd_add_buttons() {
  global $pagenow;
	if($pagenow == 'edit.php' && $_GET['post_type'] == 'yourcustomposttype'){
		echo ".add-new-h2{display: none;}";
add_action('admin_menu', 'hd_add_box');
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: