[wp-trac] [WordPress Trac] #29714: user_can_access_admin_page() returning false for edit.php?post_type=CPT
WordPress Trac
noreply at wordpress.org
Sat Sep 20 13:00:05 UTC 2014
#29714: user_can_access_admin_page() returning false for edit.php?post_type=CPT
-----------------------------+------------------------------
Reporter: bobbingwide | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Role/Capability | Version: 4.0
Severity: normal | Resolution:
Keywords: | Focuses:
-----------------------------+------------------------------
Comment (by bobbingwide):
'''Workaround'''
The above fix can be implemented as a workaround.
Create a filter function for "user_has_cap". In that filter function, when
the capability being checked for is that which you have defined ( e.g.
"edit_oik_sites"), add the following logic.
{{{
global $pagenow;
if ( $pagenow == "edit.php" && isset( $_REQUEST['post_type'] ) ) {
$pagenow .= '?post_type=' . $_REQUEST['post_type' ];
}
}}}
This will then allow the failing function ( user_can_access_admin_page() )
to return true.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29714#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list