• Hello,

    May I request to add a filter for the $capability in add_submenu_page(), add_menu_page() in wp-admin/includes/plugin.php

    Posible implementation will be for add_menu_page line 1310
    $capability = apply_filters( 'add_menu_page_' . $menu_slug . '_capability', $capability);

    Posible implementation for add_submenu_page line 1411
    $capability = apply_filters( 'add_submenu_page_' . $menu_slug . '_capability', $capability);

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Thanks for the suggestion. A filter isn’t really necessary because the caps are stored in global $menu. You can directly alter the cap of any menu item in the array. Use the “admin_menu” action hook. Add with a large priority arg to ensure all menu items have been added before your callback executes.

Viewing 1 replies (of 1 total)
  • The topic ‘Add Filter to Capability in admin menu functions’ is closed to new replies.