[wp-trac] [WordPress Trac] #57147: custom post types no longer saving/retrieving correctly

WordPress Trac noreply at wordpress.org
Mon Nov 28 19:25:57 UTC 2022


#57147: custom post types no longer saving/retrieving correctly
-------------------------------+------------------------------
 Reporter:  wellituser         |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  6.1
 Severity:  major              |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by wellituser):

 I worked out what the issue was:

 This line needs to change so you're checking the edit_post capability
 against the specific post you're trying to save.

 if( !current_user_can( 'edit_post' ) ) return;
 So that line above becomes this:

 if (!current_user_can('edit_post', $post_id)) return;

 This seems to be required after the WordPress v6.1 update.

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


More information about the wp-trac mailing list