[wp-trac] [WordPress Trac] #56962: current_user_can( 'read_post' ) not working.
WordPress Trac
noreply at wordpress.org
Wed Nov 2 15:54:34 UTC 2022
#56962: current_user_can( 'read_post' ) not working.
--------------------------+------------------------------
Reporter: jcorbin | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 6.1
Severity: major | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by TimothyBlynJacobs):
I'm not sure yet what may have caused this regression. However, I did want
to note that that is improper use of the `read_post` capability. You
''must'' pass the post ID that you want to check the user has permission
for as the second parameter to the function call.
This would be the correct usage:
{{{#!php
current_user_can( 'read_post', $post->ID )
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56962#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list