New answers tagged

0

You can simply add your menu page like this, I hope it's a simple approach class MyPlugin{ function __construct() { add_action('admin_menu', array($this, 'add_menu_page_fun')); } // Add Menu Page function add_menu_page_fun() { add_menu_page( __('My Plugin Page','myplugin-menupage'), //Page title ...


0

I found the code I was looking for, thank you. add_action( 'admin_init', 'my_remove_menu_pages' ); function my_remove_menu_pages() { global $user_ID; if ( current_user_can( 'author' ) ) { remove_menu_page( 'tools.php' ); remove_menu_page( 'edit-comments.php' ); remove_menu_page( 'wpcf7' ); remove_menu_page( 'upload.php' ); remove_menu_page( 'index.php' ); ...


1

This is a great question. I have never seen any kind of framework inside Wordpress for building forms, and after a bit of searching now to verify this, I don't think there is one, although I'm sure others will correct me if there is ;-) So, you probably need to hand code forms as you would with a fresh HTML page. However, there are a bunch of guidelines out ...


0

If you want to exclude menu items by their labels: function hide_menu_items( $items ) { $items_to_exclude = ['Menu Item 1', 'Menu Item 2']; if ( !current_user_can( 'manage_options' ) ) foreach ($items as $key => $item) if ( in_array( $item->title, $items_to_exclude ) ) unset( $items[$key] ); return $items; } add_filter( '...


Top 50 recent answers are included