Skip to content

Instantly share code, notes, and snippets.

@jrobinsonc
Last active October 5, 2016 19:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrobinsonc/4547463 to your computer and use it in GitHub Desktop.
Save jrobinsonc/4547463 to your computer and use it in GitHub Desktop.
Wordpress: Hide Post Type UI/Menu#wordpress

Wordpress: Hide Post Type UI/Menu

Para eliminar un item del menu se usa la funcion remove_menu_page (Ref: http://codex.wordpress.org/Function_Reference/remove_menu_page)

Eliminar un custom post-type de los usuarios que no son administradores.

function my_remove_menu_items() 
{
    if(!current_user_can('manage_options')):
        remove_menu_page('edit.php?post_type=your_post_type');
    endif;
}
add_action('admin_menu', 'my_remove_menu_items');

your_post_type debe ser el tipo de post que deseas quitar.

Los elementos que se pueden eliminar son:

remove_menu_page('edit.php'); // Posts
remove_menu_page('upload.php'); // Media
remove_menu_page('link-manager.php'); // Links
remove_menu_page('edit-comments.php'); // Comments
remove_menu_page('edit.php?post_type=page'); // Pages
remove_menu_page('plugins.php'); // Plugins
remove_menu_page('themes.php'); // Appearance
remove_menu_page('users.php'); // Users
remove_menu_page('tools.php'); // Tools
remove_menu_page('options-general.php'); // Settings


remove_menu_page('wpcf7'); // Plugin: Contact Form 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment