[wp-trac] [WordPress Trac] #47690: remove_submenu_page() doesn't remove corresponding entry from $_wp_submenu_nopriv

WordPress Trac noreply at wordpress.org
Fri Jul 12 10:41:10 UTC 2019


#47690: remove_submenu_page() doesn't remove corresponding entry from
$_wp_submenu_nopriv
----------------------------+-------------------------
 Reporter:  johnbillion     |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  5.3
Component:  Administration  |    Version:
 Severity:  normal          |   Keywords:  needs-patch
  Focuses:  administration  |
----------------------------+-------------------------
 It can sometimes be desirable to give access to a submenu to a user that
 wouldn't normally have access to it.

 Calling `remove_submenu_page()` and then calling `add_submenu_page()` to
 re-register the screen with a different user capability doesn't work
 completely because the entry that gets added to the `$_wp_submenu_nopriv`
 global by `add_submenu_page()` doesn't get removed by
 `remove_submenu_page()`.

 This means the menu item appears but access to the screen is denied when
 `user_can_access_admin_page()` is called, resulting in  a `Sorry, you are
 not allowed to access this page` error.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47690>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list