WordPress Remove Submenus

Replace all occurrences of $current_user->user_login == ‘username’ with in_array(‘editor’, $current_user->roles). And you can remove the call to get_currentuserinfo(); as for the user information is available from the global variable $current_user. Here’s a code swap: add_action(‘_admin_menu’, ‘remove_editor_submenu’, 1); function remove_editor_submenu() { global $current_user; if(in_array(‘editor’, $current_user->roles)) { remove_action(‘admin_menu’, ‘_add_themes_utility_last’, 101); } } add_action(‘admin_init’, ‘remove_theme_submenus’); function remove_theme_submenus() { … Read more

re-register custom post type with custom capabilities

Have you tried something like this: ‘description’ => __( ‘This is where you can add new Connectors’ ), ‘public’ => true, ‘show_ui’ => true, ‘capability_type’ => ‘page’, ‘publicly_queryable’ => true, ‘exclude_from_search’ => false, ‘hierarchical’ => true, ‘capabilities’ => array( ‘publish_posts’ => ‘update_core’, ‘edit_others_posts’ => ‘update_core’, ‘delete_posts’ => ‘update_core’, ‘delete_others_posts’ => ‘update_core’, ‘read_private_posts’ => ‘update_core’, ‘edit_post’ … Read more

Capability to prevent upload of files

You can try with this: function remove_media_tabs($strings) { unset($strings[“insertFromUrlTitle”]); unset($strings[“setFeaturedImageTitle”]); unset($strings[“createGalleryTitle”]); unset($strings[“uploadFilesTitle”]); return $strings; } add_filter(‘media_view_strings’,’remove_media_tabs’); This will remove ‘Upload file’ and ‘Insert from URL’ links when you open insert media screen, so user will be able only to select images or whatever that is already in media library. For more things you can do … Read more