WordPress edit admin menu

<?php
function edit_admin_menu() {
	global $menu;
 
	//echo '<br> menu:<pre>';
	//print_r( $menu );
	//echo '</pre_>';
 
	remove_menu_page( 'edit.php' ); // remove posts item
	remove_menu_page( 'edit.php?post_type=page' ); // remove pages item
	remove_menu_page( 'edit-comments.php' ); // remove comments item
	remove_menu_page( 'themes.php' ); // remove themes item
	remove_menu_page( 'plugins.php' ); // remove plugins item
	remove_menu_page( 'tools.php' ); // remove tools item
	remove_menu_page( 'options-general.php' ); // remove options item
}
add_action( 'admin_init', 'edit_admin_menu' );
?>

But user still can visit removed links but entering address manually.

Leave a Reply

Your email address will not be published. Required fields are marked *