Add filter for submenu capability
-
This topic is closed so I couldn’t add a reply: https://ww.wp.xz.cn/support/topic/add-filter-to-capability-in-admin-menu-functions/
But @bcworkz response does not work for submenu items because they are not added to the
$submenuglobal if the user does not have the capability. So if a plugin registers a submenu withmanage_optionscapability, and you hook intoadmin_menuto change it instead toedit_posts, it does not exist in the$submenuarray at all. So unless a filter is added by the plugin author, there is no way to override the capability, without duplicating the plugins code and usingadd_submenu_page()yourself, but then you’d have to modify as the plugin updates.
The topic ‘Add filter for submenu capability’ is closed to new replies.