Is it possible to control order of all Admin Menu Items?
Is it possible to control order of all Admin Menu Items?
Is it possible to control order of all Admin Menu Items?
Just like posts with WP_Query and pre_get_posts, there is WP_User_Query and pre_get_users that lets you modify the query parameters for fetching the users. This is the most efficient method of adjusting the list of users. e.g. add_action( ‘pre_get_users’, ‘justin_wylllie_pre_get_users’ ); function justin_wylllie_pre_get_users( \WP_User_Query $query ): void { // … modify the query object if we’re … Read more
You’re getting the blank rows because your column headers are registered late. And you should register the headers (i.e. initialize the list table class instance) before admin notices are rendered on the page, i.e. before WordPress fires hooks like admin_notices. But your customer_list_page() function, which I believe, is a callback for either add_menu_page() or add_submenu_page(), … Read more
here an example of how to manage multiple set of options. it needs to be completed by a nonce to avoid CSRF attack and it needs also a little bit of layout. add_action(“admin_menu”, function () { add_menu_page( “Multioptions” , “Multioptions” , “manage_options” // capability to be allowed to edit options , “MY_PLUGIN__multioptions” , function () … Read more
One custom taxonomy with unique sets of labels for two post types?
You’ll need something like this: function your_callback() { if ( ! current_user_can( ‘manage_options’ ) ) { return; } // add your code here to display the menu for admins only } Basically you need to check what capabilities the current user has and then select one which only admins have List of Roles & Capabilities … Read more
This works for me: // Remove WP Block add_action(‘admin_init’, ‘remove_wp_block_menu’, 100); function remove_wp_block_menu() { remove_submenu_page( ‘themes.php’, ‘edit.php?post_type=wp_block’ ); }
To directly answer your question, you can use the wp_setup_nav_menu_item filter to change properties of the nav menu item: add_filter( ‘wp_setup_nav_menu_item’, static function ( $menu_item ) { if ( ! is_admin() || empty( $menu_item->taxonomy ) || ‘category’ !== $menu_item->taxonomy ) { return $menu_item; } $menu_item->title .= sprintf( ‘ (%s)’, $menu_item->slug ); return $menu_item; } ); … Read more
Try to use the slug of the pages as parameter, e.g. remove_menu_page( ‘dashboard’ ); instead of remove_menu_page( ‘admin.php?page=dashboard’ );.
Create a menu and a submenu