[wp-trac] [WordPress Trac] #56280: Access denied to custom post type listing in admin when his submenu is empty
WordPress Trac
noreply at wordpress.org
Sat Jul 23 17:25:11 UTC 2022
#56280: Access denied to custom post type listing in admin when his submenu is
empty
----------------------------+-----------------------------
Reporter: luistar15 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 6.0
Severity: major | Keywords:
Focuses: administration |
----------------------------+-----------------------------
I created a custom post type and a custom role with capabilities only for
the custom post type. Then I was trying to hide the submenu for the custom
post type and leave only the main menu item, but when I do it, the user
can't not longer access de page to view the custom post types or to add a
new one.
"Sorry, you are not allowed to access this page."
Steps to reproduce:
1. Add "Movies" Custom Post Type
2. Hide "Movies" submenu (remove_submenu_page)
3. Register "Movie Editor" role
4. Create a user with "Movie Editor" role
5. Login to the admin section as the new user
6. Try to access the Movies page in the admin
I build a plugin that shows the problem.
https://gist.github.com/leo020588/c9b82883fc1b0275e0f46bf0b0ece083
My reasoning for why this is a bug, is because the custom post type and
the role have the right permissions, so even if the submenu is hidden it
should possible to view the list of custom post types from the main menu
which is still visible.
Wordpress: 6.0.1
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56280>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list