goenaga
10/27/2015 - 7:17 PM

Ocultar menus en la administración

Ocultar menus en la administración

function cliente($username){
	$current_user = wp_get_current_user();
	if($current_user->user_login == $username){
		return true;
	}else{
		return false;

	}
}

if(cliente('nombre_usuario')){

}
add_action( 'admin_menu', 'register_my_custom_menu_page' );

function register_my_custom_menu_page() {

	add_menu_page( 'Tutorial', 'Tutorial', 'manage_options', 'post.php?post=22&action=edit', '', '', 6 );

}
// remove submenu items from the wordpress admin
function wcs_remove_submenus() {
    global $submenu;

    // dashboard menu
    unset( $submenu['index.php'][10] ); // removes updates

    // posts menu
    unset( $submenu['edit.php'][5] ); // removes list of posts
    unset( $submenu['edit.php'][10] ); // removes add new post
    unset( $submenu['edit.php'][15] ); // remove categories
    unset( $submenu['edit.php'][16] ); // removes tags

    // media menu
    unset( $submenu['upload.php'][5] ); // removes view media library
    unset( $submenu['upload.php'][10] ); // removes add to media library

    // links menu
    unset( $submenu['link-manager.php'][5] ); // removes link manager
    unset( $submenu['link-manager.php'][10] ); // removes add new link
    unset( $submenu['link-manager.php'][15] ); // removes link categories

    // pages menu
    unset( $submenu['edit.php?post_type=page'][5] ); // removes list of pages
    unset( $submenu['edit.php?post_type=page'][10] ); // removes add new page

    // appearance menu
    unset( $submenu['themes.php'][5] ); // removes themes
    unset( $submenu['themes.php'][7] ); // removes widgets
    unset( $submenu['themes.php'][15] ); // removes theme installer

    // plugins menu
    unset( $submenu['plugins.php'][5] ); // removes plugin manager
    unset( $submenu['plugins.php'][10] ); // removes add new plugins
    unset( $submenu['plugins.php'][15] ); // removes plugin editor

    // users menu
    unset( $submenu['users.php'][5] ); // removes list of users
    unset( $submenu['users.php'][10] ); // removes add new user
    unset( $submenu['users.php'][15] ); // removes edit your profile

    // tools menu
    unset( $submenu['tools.php'][5] ); // removes tools area
    unset( $submenu['tools.php'][10] ); // removes import
    unset( $submenu['tools.php'][15] ); // removes export
    unset( $submenu['tools.php'][20] ); // removes upgrade plugins and core files

    // settings menu
    unset( $submenu['options-general.php'][10] ); // removes general options
    unset( $submenu['options-general.php'][15] ); // removes writing
    unset( $submenu['options-general.php'][20] ); // removes reading
    unset( $submenu['options-general.php'][25] ); // removes discussion
    unset( $submenu['options-general.php'][30] ); // removes media
    unset( $submenu['options-general.php'][35] ); // removes privacy
    unset( $submenu['options-general.php'][40] ); // removes permalinks
    unset( $submenu['options-general.php'][45] ); // removes misc
}
add_action( 'admin_menu', 'wcs_remove_submenus' );
		function remove_acf_menu() {
			remove_menu_page('edit.php?post_type=acf');

		}
		add_action( 'admin_menu', 'remove_acf_menu', 999);