[wp-trac] [WordPress Trac] #56962: current_user_can( 'read_post' ) not working.

WordPress Trac noreply at wordpress.org
Thu Nov 24 14:01:27 UTC 2022


#56962: current_user_can( 'read_post' )  not working.
-----------------------------+----------------------
 Reporter:  jcorbin          |       Owner:  (none)
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Role/Capability  |     Version:  6.1
 Severity:  major            |  Resolution:  wontfix
 Keywords:  close            |     Focuses:
-----------------------------+----------------------

Comment (by SergeyBiryukov):

 Replying to [comment:9 pikamander2]:
 > Ideally, if one of those four capabilities (save_post, publish_post,
 edit_post, delete_post) is passed to current_user_can, it would be nice
 for it to write a clear message to the error log explaining what the
 problem is.

 I might be missing something, but [53408] / #44591 does include a
 `_doing_it_wrong()` message that should be added to the error log if
 `WP_DEBUG` is enabled:
 > `Notice: Function map_meta_cap was called incorrectly. When checking for
 the edit_post capability, you must always check it against a specific
 post. Please see Debugging in WordPress for more information. (This
 message was added in version 6.1.0.)`

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56962#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list