function remove_menus()
{
    //remove_menu_page( 'index.php' );             	//Dashboard
    remove_submenu_page('index.php', 'update-core.php');
    //remove_submenu_page( $menu_slug, $submenu_slug );
    remove_menu_page('edit.php');
    //Posts
    remove_menu_page('upload.php');
    //Media
    remove_menu_page('edit.php?post_type=page');
    //Pages
    remove_menu_page('edit-comments.php');
    //Comments
    remove_menu_page('themes.php');
    //Appearance
    remove_menu_page('plugins.php');
    //Plugins
    remove_menu_page('users.php');
    //Users
    remove_menu_page('tools.php');
    //Tools
    remove_menu_page('options-general.php');
    //Settings
    remove_menu_page('edit.php?post_type=acf');
    //ACF
}
function remove_admin_menus()
{
    if (!current_user_can('manage_options')) {
        // Only proceed if user does not have admin role.
        remove_menu_page('index.php');
        // Dashboard
        //remove_menu_page('edit.php'); 				// Posts
        //remove_menu_page('upload.php'); 			// Media
        //remove_menu_page('link-manager.php'); 			// Links
        //remove_menu_page('edit.php?post_type=page'); 		// Pages
        remove_menu_page('edit-comments.php');
        // Comments
        //remove_menu_page('themes.php'); 			// Appearance
        //remove_menu_page('plugins.php'); 			// Plugins
        remove_menu_page('profile.php');
        // Profile
        remove_menu_page('tools.php');
        // Tools
        //remove_menu_page('options-general.php'); 		// Settings
        //remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=post_tag' );	// Remove posts->tags submenu
        //remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=category' );	// Remove posts->categories submenu
        remove_submenu_page('index.php', 'index.php?page=simple_history_page');
        remove_submenu_page('themes.php', 'themes.php');
        remove_submenu_page('themes.php', 'widgets.php');
    }
}
function ground_remove_menu_links()
{
    remove_menu_page('index.php');
    // Dashboard
    remove_menu_page('edit.php');
    // Posts
    remove_menu_page('upload.php');
    // Media
    remove_menu_page('edit.php?post_type=page');
    // Pages
    remove_menu_page('edit-comments.php');
    // Comments
    remove_menu_page('themes.php');
    // Appearance
    remove_menu_page('plugins.php');
    // Plugins
    remove_menu_page('users.php');
    // Users
    remove_menu_page('tools.php');
    // Tools
    remove_menu_page('options-general.php');
    // Settings
    remove_submenu_page('themes.php', 'theme-editor.php');
    // Submenu
}
function remove_menus()
{
    remove_menu_page('edit-comments.php');
    //remove_menu_page( 'themes.php' );
    //remove_menu_page('plugins.php');
    //remove_menu_page('tools.php');
}
function edit_wp_menu()
{
    //-----------------------------------------------
    // Remove menu items
    //-----------------------------------------------
    remove_menu_page('edit-comments.php');
    //-----------------------------------------------
    // Add a menu item
    //-----------------------------------------------
    add_menu_page('New Comments', 'My Comments', 'manage_options', 'edit-comments.php', '', '', 6);
    //-----------------------------------------------
    // Change the menu order
    //-----------------------------------------------
    function change_menu_order($menu_order)
    {
        return array('index.php', 'themes.php', 'edit.php', 'upload.php');
    }
    add_filter('custom_menu_order', '__return_true');
    add_filter('menu_order', 'change_menu_order');
    //-----------------------------------------------
    // Rename Posts to Articles
    //-----------------------------------------------
    global $menu;
    global $submenu;
    $menu[5][0] = 'Articles';
    $submenu['edit.php'][5][0] = 'All Articles';
    $submenu['edit.php'][10][0] = 'Add an Article';
    $submenu['edit.php'][15][0] = 'Article Categories';
    $submenu['edit.php'][16][0] = 'Article Tags';
}
function jk_remove_menus()
{
    // Posts
    remove_menu_page('edit.php');
    // Comments
    remove_menu_page('edit-comments.php');
    // Projects
    remove_menu_page('edit.php?post_type=project');
    // Testimonials
    remove_menu_page('edit.php?post_type=testimonial');
    // Profile
    remove_menu_page('profile.php');
    // Remove for all users below Administrator
    $user = wp_get_current_user();
    if (!$user->has_cap('manage_options')) {
        // Tools
        remove_menu_page('tools.php');
        // My Sites
        remove_menu_page('my-sites.php');
    }
    // Remove for all users below Super-Admin
    $user = wp_get_current_user();
    if (!$user->has_cap('manage_network')) {
        // Plugins
        remove_menu_page('plugins.php');
        // Widgets submenu
        $page = remove_submenu_page('themes.php', 'widgets.php');
    }
}
function remove_menus()
{
    remove_menu_page('index.php');
    //Консоль
    remove_menu_page('edit-comments.php');
    //Комментарии
}
function remove_admin_items()
{
    // Posts
    remove_menu_page('edit.php');
    // Comments
    remove_menu_page('edit-comments.php');
}
Beispiel #9
0
function hide_dashboard()
{
    global $blog, $current_user, $id, $parent_file, $wphd_user_capability;
    if (!current_user_can('' . $wphd_user_capability . '')) {
        /* First, let's get rid of the Help menu, Update nag, Personal Options section */
        echo "\n" . '<style type="text/css" media="screen">#your-profile { display: none; } .update-nag, #contextual-help-wrap, #contextual-help-link-wrap { display: none !important; }</style>';
        echo "\n" . '<script type="text/javascript">jQuery(document).ready(function($) { $(\'form#your-profile > h3:first\').hide(); $(\'form#your-profile > table:first\').hide(); $(\'form#your-profile\').show(); });</script>' . "\n";
        /* Now, let's fix the sidebar admin menu - go away, Dashboard link. */
        /* If Multisite, check whether they are in the User Dashboard before removing links */
        $user_id = get_current_user_id();
        $blogs = get_blogs_of_user($user_id);
        if (is_multisite() && is_admin() && empty($blogs)) {
            return;
        } else {
            remove_menu_page('index.php');
            /* Hides Dashboard menu */
            remove_menu_page('separator1');
            /* Hides separator under Dashboard menu*/
        }
        /* Last, but not least, let's redirect folks to their profile when they login or if they try to access the Dashboard via direct URL */
        if (is_multisite() && is_admin() && empty($blogs)) {
            return;
        } else {
            if ($parent_file == 'index.php') {
                if (headers_sent()) {
                    echo '<meta http-equiv="refresh" content="0;url=' . admin_url('profile.php') . '">';
                    echo '<script type="text/javascript">document.location.href="' . admin_url('profile.php') . '"</script>';
                } else {
                    wp_redirect(admin_url('profile.php'));
                    exit;
                }
            }
        }
    }
}
Beispiel #10
0
function remove_menu_pages()
{
    //remove_menu_page('tools.php');
    remove_menu_page('edit-comments.php');
    //remove_menu_page('edit.php');
    //remove_menu_page('plugins.php');
}
/**
 * Remove unused menu items
 */
function custom_menu_page_removing()
{
    global $menu;
    foreach (['edit-comments.php', 'upload.php', 'edit.php?post_type=page'] as $m) {
        remove_menu_page($m);
    }
}
function ticr_remove_admin_menu_items()
{
    $remove_items = array('dt_portfolio', 'dt_testimonials', 'dt_team', 'dt_benefits', 'dt_slideshow');
    foreach ($remove_items as $item) {
        remove_menu_page('edit.php?post_type=' . $item);
    }
}
/**
 * In BP 1.6, the top-level admin menu was removed. For backpat, this function
 * keeps the top-level menu if a plugin has registered a menu into the old
 * 'bp-general-settings' menu.
 *
 * The old "bp-general-settings" page was renamed "bp-components".
 *
 * @global array $_parent_pages
 * @global array $_registered_pages
 * @global array $submenu
 * @since BuddyPress (1.6)
 */
function bp_core_admin_backpat_menu() {
	global $_parent_pages, $_registered_pages, $submenu;

	// If there's no bp-general-settings menu (perhaps because the current
	// user is not an Administrator), there's nothing to do here
	if ( ! isset( $submenu['bp-general-settings'] ) ) {
		return;
	}

	/**
	 * By default, only the core "Help" submenu is added under the top-level BuddyPress menu.
	 * This means that if no third-party plugins have registered their admin pages into the
	 * 'bp-general-settings' menu, it will only contain one item. Kill it.
	 */
	if ( 1 != count( $submenu['bp-general-settings'] ) ) {
		return;
	}

	// This removes the top-level menu
	remove_submenu_page( 'bp-general-settings', 'bp-general-settings' );
	remove_menu_page( 'bp-general-settings' );

	// These stop people accessing the URL directly
	unset( $_parent_pages['bp-general-settings'] );
	unset( $_registered_pages['toplevel_page_bp-general-settings'] );
}
Beispiel #14
0
/**
 * Add admin pages and setup submenus
 *
 * @since 0.1.0
 */
function wp_user_profiles_admin_menus()
{
    // Empty hooks array
    $hooks = array();
    $file = wp_user_profiles_get_file();
    $sections = wp_user_profiles_sections();
    // Add a visbile "Your Profile" link
    if ('users.php' === $file) {
        // Remove the core "Your Profile" submenu
        unset($GLOBALS['submenu']['users.php'][15]);
        // Add (and quickly remove) submenu pages
        foreach ($sections as $tab) {
            $hooks[] = add_submenu_page($file, $tab['name'], $tab['name'], $tab['cap'], $tab['slug'], 'wp_user_profiles_user_admin');
            remove_submenu_page($file, $tab['slug']);
        }
        // Re-add new "Your Profile" submenu
        add_submenu_page($file, esc_html__('Your Profile', 'wp-user-profiles'), esc_html__('Your Profile', 'wp-user-profiles'), 'read', 'profile', 'wp_user_profiles_user_admin');
        // Fudge the highlighted subnav item
        foreach ($hooks as $hook) {
            add_action("admin_head-{$hook}", 'wp_user_profiles_admin_menu_highlight');
        }
        // User admin needs some coercing
    } elseif (is_user_admin()) {
        remove_menu_page('profile.php');
        foreach ($sections as $tab) {
            add_menu_page($tab['name'], $tab['name'], 'exist', $tab['slug'], 'wp_user_profiles_user_admin', $tab['icon'], $tab['order']);
        }
    } else {
        add_submenu_page($file, esc_html__('Profile', 'wp-user-profiles'), esc_html__('Profile', 'wp-user-profiles'), 'read', 'profile', 'wp_user_profiles_user_admin');
    }
}
/** Add plugin menu ***/
function gsw_manage_menu_pages()
{
    if (current_user_can('manage_options')) {
        add_menu_page('Germany Says Welcome Overview', 'Germany Says Welcome', 'read', 'gsw_overview', 'gsw_overview', GSW_PATH . 'images/logo_small.png');
        add_submenu_page('gsw_overview', 'Overview for the GSW Plugin', 'Overview', 'read', 'gsw_overview', 'gsw_intro');
    } else {
        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_submenu_page('index.php', 'update-core.php');
    }
}
Beispiel #16
0
 public final function admin_menu()
 {
     /**
      * Adds a custom page to WordPress
      */
     add_menu_page($this->title, '', 'manage_options', 'custom-page', array($this, 'page_content'));
     /**
      * Remove the custom page from the admin menu
      */
     remove_menu_page('custom-page');
     /**
      * Make dashboard menu item the active item
      */
     global $parent_file, $submenu_file;
     $parent_file = 'index.php';
     $submenu_file = 'index.php';
     /**
      * Rename the dashboard menu item
      */
     global $menu;
     $menu[2][0] = $this->title;
     /**
      * Rename the dashboard submenu item
      */
     global $submenu;
     $submenu['index.php'][0][0] = $this->title;
 }
function edit_admin_menu()
{
    // homepage shortcut ?
    //$homeID = 18;
    //add_menu_page('Home','Home','edit_posts', "post.php?post=$homeID&action=edit",'','dashicons-admin-home',10);
    // options.php shortcut ?
    // add_options_page('All Settings', 'All Settings', 'administrator', 'options.php');
    // remove menus
    remove_menu_page('edit-comments.php');
    // comments
    remove_menu_page('link-manager.php');
    // link manager
    // Appearance
    // remove_menu_page( 'themes.php' ); // remove entire appearance menu altogether
    remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=post_tag');
    // post tags
    remove_submenu_page('themes.php', 'widgets.php');
    // widgets
    remove_submenu_page('themes.php', 'nav_menu.php');
    // widgets
    remove_submenu_page('themes.php', 'theme-editor.php');
    // theme editor
    global $submenu;
    unset($submenu['themes.php'][6]);
    // customize
    // reposition media tab
    remove_menu_page('upload.php');
    add_menu_page('Media', 'Media', 'Contributor', 'upload.php', '', 'dashicons-admin-media', 23);
}
function admin_menu_anpassen_alle()
{
    $toRemove = array('edit-comments.php');
    foreach ($toRemove as $remove) {
        remove_menu_page($remove);
    }
}
/**
 * Remove menu items on a per user bases
 */
function uas_edit_admin_menus()
{
    global $menu;
    global $current_user;
    global $storedmenu;
    global $storedsubmenu;
    global $submenu;
    // Store the original menu
    $storedmenu = $menu;
    // Store the original submenu
    $storedsubmenu = $submenu;
    $uas_options = uas_get_admin_options();
    $newmenu = array();
    if (!isset($menu)) {
        return;
    }
    // Rebuild menu based on saved options
    foreach ($menu as $menuitem) {
        if (isset($menuitem[5]) && isset($uas_options[$current_user->user_nicename][sanitize_key($menuitem[5])]) && 1 == $uas_options[$current_user->user_nicename][sanitize_key($menuitem[5])]) {
            remove_menu_page($menuitem[2]);
        } else {
            // Lets check the submenus
            if (isset($storedsubmenu[$menuitem[2]])) {
                foreach ($storedsubmenu[$menuitem[2]] as $subsub) {
                    $combinedname = sanitize_key($menuitem[5] . $subsub[2]);
                    if (isset($subsub[2]) && isset($uas_options[$current_user->user_nicename][$combinedname]) && 1 == $uas_options[$current_user->user_nicename][$combinedname]) {
                        remove_submenu_page($menuitem[2], $subsub[2]);
                    }
                }
            }
        }
    }
}
Beispiel #20
0
/**
 * Remove some admin menu items
 * 
 * @package d7
 * @subpackage boilerplate-plugin_filters+hooks
 * @internal only called as `admin_menu` action
 * 
 */
function d7_remove_menus()
{
    remove_menu_page('edit.php');
    remove_menu_page('edit-comments.php');
    remove_submenu_page('themes.php', 'theme-editor.php');
    remove_submenu_page('plugins.php', 'plugin-editor.php');
}
function wptutsplus_remove_comments_menu_item()
{
    $user = wp_get_current_user();
    if (!$user->has_cap('manage_options')) {
        remove_menu_page('edit-comments.php');
    }
}
Beispiel #22
0
 /**
  * Removes the post type "post/page" from admin
  * @return NULL
  */
 public function removePostPostType()
 {
     global $wp_post_types;
     if (isset($wp_post_types['post'])) {
         if (function_exists('get_field') && get_field('disable_default_blog_post_type')) {
             add_action('admin_menu', function () {
                 remove_menu_page('edit.php');
             });
             add_action('wp_before_admin_bar_render', function () {
                 global $wp_admin_bar;
                 $wp_admin_bar->remove_menu('new-post');
             });
         }
     }
     if (isset($wp_post_types['page'])) {
         if (function_exists('get_field') && get_field('disable_default_page_post_type')) {
             add_action('admin_menu', function () {
                 remove_menu_page('edit.php?post_type=page');
             });
             add_action('wp_before_admin_bar_render', function () {
                 global $wp_admin_bar;
                 $wp_admin_bar->remove_menu('new-page');
             });
         }
     }
     return null;
 }
function uas_edit_admin_menus()
{
    global $menu;
    global $current_user;
    global $storedmenu;
    global $storedsubmenu;
    global $submenu;
    $storedmenu = $menu;
    //store the original menu
    $storedsubmenu = $submenu;
    //store the original menu
    $uas_options = uas_get_admin_options();
    $newmenu = array();
    //rebuild menu based on saved options
    foreach ($menu as $menuitem) {
        if (isset($menuitem[5]) && isset($uas_options[$current_user->user_login][$menuitem[5]]) && 1 == $uas_options[$current_user->user_login][$menuitem[5]]) {
            remove_menu_page($menuitem[2]);
        } else {
            // lets check the submenus
            if (isset($storedsubmenu[$menuitem[2]])) {
                foreach ($storedsubmenu[$menuitem[2]] as $subsub) {
                    $combinedname = $menuitem[5] . $subsub[2];
                    if (isset($subsub[2]) && isset($uas_options[$current_user->user_login][$combinedname]) && 1 == $uas_options[$current_user->user_login][$combinedname]) {
                        remove_submenu_page($menuitem[2], $subsub[2]);
                    }
                }
            }
        }
    }
}
Beispiel #24
0
function hide_menu()
{
    global $current_user;
    $user_id = get_current_user_id();
    // echo "user:".$user_id;   // Use this to find your user id quickly
    if ($user_id != '1') {
        remove_menu_page('index.php');
        //Dashboard
        remove_menu_page('upload.php');
        //Media
        remove_menu_page('edit-comments.php');
        //Comments
        remove_menu_page('plugins.php');
        //Plugins
        remove_submenu_page('themes.php', 'themes.php');
        remove_submenu_page('themes.php', 'theme-editor.php');
        remove_submenu_page('themes.php', 'customize.php');
        remove_menu_page('nav-menus.php');
        //Editar Menus
        // remove_menu_page( 'users.php' );                  	Users
        remove_menu_page('tools.php');
        //Tools
        remove_menu_page('options-general.php');
        //Settings
        remove_menu_page('edit.php?post_type=acf');
        //Advanced Custom Fields
        remove_menu_page('admin.php?page=cpt_main_menu');
        //Custom Post Types
        remove_menu_page('themes.php');
        //Custom Fields
    }
}
Beispiel #25
0
/**
 * This function removes unnecesary menus from the WP Admin
 * (Except for administrators)
 */
function remove_menus()
{
    if (is_admin() && !current_user_can('manage_options')) {
        remove_menu_page('index.php');
        //Dashboard
        remove_menu_page('edit.php');
        //Posts
        remove_menu_page('upload.php');
        //Media
        remove_menu_page('edit.php?post_type=page');
        //Pages
        remove_menu_page('edit-comments.php');
        //Comments
        remove_menu_page('themes.php');
        //Appearance
        remove_menu_page('plugins.php');
        //Plugins
        remove_menu_page('users.php');
        //Users
        remove_menu_page('tools.php');
        //Tools
        remove_menu_page('options-general.php');
        //Settings
    }
}
Beispiel #26
0
function remove_links_menu()
{
    remove_menu_page('index.php');
    // Dashboard
    remove_menu_page('edit.php');
    // Posts
    remove_menu_page('upload.php');
    // Media
    remove_menu_page('link-manager.php');
    // Links
    remove_menu_page('edit.php?post_type=page');
    // Pages
    remove_menu_page('edit-comments.php');
    // Comments
    remove_menu_page('themes.php');
    // Appearance
    remove_menu_page('plugins.php');
    // Plugins
    if (!current_user_can('edit_posts')) {
        remove_menu_page('users.php');
        // Users
        remove_menu_page('options-general.php');
        // Settings
    }
    remove_menu_page('tools.php');
    // Tools
}
Beispiel #27
0
function xelly_remove_menu_items()
{
    // тут мы укахываем ярлык пункты который удаляем.
    remove_menu_page('edit-comments.php');
    remove_menu_page('plugins.php');
    remove_menu_page('tools.php');
}
/**
 * Removes the supplied menu page slugs from the admin menu
 * @param  array $pages An array of page slugs to remove from the admin menu
 */
function bp_remove_admin_menu_pages($pages)
{
    add_action('admin_menu', function () use($pages) {
        foreach ($pages as $page) {
            remove_menu_page($page);
        }
    });
}
/**
 * Example filter to remove the Email Users Dashboard menu for non-admin users.
 *
 * @see https://wordpress.org/support/topic/totally-disable-the-admin-email-user-menu-for-users-wp-admin-menu
 *
 * To use this filter, copy the code below to your functions.php
 * file and modify it to suit the application (e.g. change the capability
 * check to something else).
 */
function remove_email_users_menus()
{
    //  Check to see if the current user has Admin capabilities ...
    if (!current_user_can('activate_plugins')) {
        $slug = plugin_basename('email-users' . DIRECTORY_SEPARATOR . 'email-users.php');
        remove_menu_page($slug);
    }
}
Beispiel #30
0
function _tool_remove_menu_pages()
{
    //global $menu; print_o( $menu );
    // Beiträge: edit.php
    foreach ($GLOBALS['toolset']['inits']['tool_wp_menu']['tool_remove_menu_pages'] as $item) {
        remove_menu_page($item['page']);
    }
}