Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove posts from admin sidebar in wordpress

Tags:

I was wondering how to remove the posts section from the wordpress admin sidebar (see image below) Wordpress Posts

like image 898
inControl Avatar asked Jun 30 '13 19:06

inControl


People also ask

How do I remove menu items from WordPress admin panel?

Upon activation, you can head over to Settings » Menu Editor from your WordPress dashboard. Next, you'll see all your menu and submenu items under the 'Admin Menu' tab. You can simply drag and drop your menu items to rearrange their order. There are also options to remove or add new menu items.

How do I remove an admin from WordPress post?

If you want to disable the admin bar for any particular user in WordPress, you'll need to edit their user profile. Simply go to the Users » All Users page and then click on the 'edit' link for any user you want to disable the admin bar for.

How do I remove a post from a WordPress page?

To delete a web page or blog post, click on the appropriate menu (Pages or Posts) and hover over the one you wish to delete.. On the hover menu, you will see a Trash option. Click this to move the page to the trash.

How do I change the sidebar on my WordPress dashboard?

Go to Settings > Menu Editor. Here you will be able to rearrange, edit, add or delete your admin menu links. You can drag-and-drop all the menu links to a new position. You can also use the toolbar icons across the top to cut, copy, paste and edit each link.


1 Answers

you will be needing to edit functions.php for this and add some code in that. This section of posts lies as edit.php

See the official wordpress codex documentation for remove_menu_page() function to understand better. Doc states function usage as:

<?php remove_menu_page( $menu_slug ) ?> 

Here $menu_slug is edit.php for post menu.

Now create your own function called post_remove() and add code in functions.php as:

function post_remove ()  {     remove_menu_page('edit.php'); }  

The next part is to hook your post_remove() function with a specific action which in this case is admin_menu to trigger this function. For that, add some more code in functions.php:

add_action('admin_menu', 'post_remove'); 

So in short, following is complete code that you need to add in your functions.php file:

function post_remove ()      //creating functions post_remove for removing menu item {     remove_menu_page('edit.php'); }  add_action('admin_menu', 'post_remove');   //adding action for triggering function call 

Official documentation links

http://codex.wordpress.org/Function_Reference/remove_menu_page http://codex.wordpress.org/Function_Reference/add_action

I hope this helps! Please do me a favor - vote up for my answer and mark it accepted.

like image 182
Shumail Avatar answered Sep 16 '22 22:09

Shumail