How to remove posts from admin sidebar in wordpress
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.
add this function to your functions.php
function remove_menu ()
{
remove_menu_page('edit.php');
}
add_action('admin_menu', 'remove_menu');