[wp-trac] [WordPress Trac] #22895: user_can_admin_menu() is Type-Insensitive for Users who Can't Create Pages
WordPress Trac
noreply at wordpress.org
Tue Feb 1 23:06:51 UTC 2022
#22895: user_can_admin_menu() is Type-Insensitive for Users who Can't Create Pages
------------------------------------+-----------------------------
Reporter: kevinB | Owner: johnbillion
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: Future Release
Component: Role/Capability | Version: 3.5
Severity: normal | Resolution:
Keywords: has-patch dev-feedback | Focuses:
------------------------------------+-----------------------------
Comment (by dougwollison):
So this is still present in 5.9
What if we slapped a filter on the result of `user_can_admin_menu()`?
Certainly a band-aid fix but it would allow people who need to patch it to
do so in a less hacky way than the add/remove menu trick Kraftner came up
with. I bet there may be some niche use cases where having this filter
would be beneficial anyway.
I can submit a patch that renames the current function to a private one,
and wrap it in a new functions that runs the result through the filter.
{{{#!php
function user_can_access_admin_page() {
/**
* Filters the result of _user_can_access_admin_page().
*/
return apply_filters( 'user_can_access_admin_page',
_user_can_access_admin_page() );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/22895#comment:37>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list