Skip to content

Instantly share code, notes, and snippets.

@mariovalney
Created May 6, 2015 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mariovalney/e7dbcbfb1e9720079dd8 to your computer and use it in GitHub Desktop.
Save mariovalney/e7dbcbfb1e9720079dd8 to your computer and use it in GitHub Desktop.
Menu Manage Functions - WordPress
// Modifica as Páginas do Menu
function meu_plugin_menu_pages() {
if (!is_super_admin()) {
remove_menu_page('index.php');
remove_menu_page('edit.php');
remove_menu_page('upload.php');
remove_menu_page('edit.php?post_type=page');
remove_menu_page('edit-comments.php');
remove_menu_page('themes.php');
remove_menu_page('plugins.php');
remove_menu_page('users.php');
remove_menu_page('tools.php');
remove_menu_page('wpcf7');
remove_submenu_page('options-general.php','options-writing.php');
remove_submenu_page('options-general.php','options-reading.php');
remove_submenu_page('options-general.php','options-discussion.php');
remove_submenu_page('options-general.php','options-media.php');
remove_submenu_page('options-general.php','options-permalink.php');
add_menu_page( 'Enviar Arquivo', 'Enviar Arquivo', 'manage_options', 'media-new.php', '', 'dashicons-upload' , 12 );
add_menu_page( 'Widgets', 'Widgets', 'manage_options', 'nav-menus.php', '', 'dashicons-tagcloud' , 6 );
}
}
add_action( 'admin_menu', 'meu_plugin_menu_pages' );
function meu_plugin_redirect_pages() {
if (!is_super_admin()) {
$screen = get_current_screen();
if( $screen->base == 'edit' || $screen->base == 'edit-comments' || $screen->base == 'themes' || $screen->base == 'plugins' || $screen->base == 'tools' ) {
echo '<style>html{visibility: hidden;}</style> <meta http-equiv="refresh" content="1;url='.admin_url().'"> <h1 style="visibility:visible!important;text-align: center;">Tentando trapacear?</h1>';
}
}
}
add_action( 'current_screen', 'meu_plugin_redirect_pages' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment