Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#47181 closed defect (bug) (invalid)

Custom post type meta won't save in new editor for user role Author

Reported by: guido07111975's profile Guido07111975 Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.2
Component: Editor Keywords:
Focuses: Cc:

Description

Hi,

When using the new editor as author I've noticed the custom post type meta fields aren't being saved. Admin and editor don't have this problem. Also classic editor works as expected.

More info can be found in [this thread]https://wordpress.org/support/topic/custom-post-meta-not-saved-for-author/

Have created a tiny example plugin for testing purposes, which can be found [here]http://www.webmastergroningen.nl/wordpress/cpt-plugin/

Guido

Change History (6)

#1 @ourakland
5 years ago

  • Severity changed from normal to major

I'm having the same problem. For editor and above, my code to check and save metadata works as desired. For author, the basic post data is saved, but by the time my save_tour_fields_meta() function is called, $_POST is empty.

The capabilities for author vs. editor are below. I've removed delete_published_posts and moderate_comments from the author role. I tried it without removing those, but still no joy.

WP_Role::__set_state(array(
   'name' => 'author',
   'capabilities' => 
  array (
    'edit_published_posts' => true,
    'publish_posts' => true,
    'read' => true,
    'level_2' => true,
    'level_1' => true,
    'level_0' => true,
    'edit_posts' => true,
    'upload_files' => true,
    'delete_posts' => true,
    'edit_post' => true,
  ),
))

WP_Role::__set_state(array(
   'name' => 'editor',
   'capabilities' => 
  array (
    'moderate_comments' => true,
    'manage_categories' => true,
    'manage_links' => true,
    'upload_files' => true,
    'unfiltered_html' => true,
    'edit_posts' => true,
    'edit_others_posts' => true,
    'edit_published_posts' => true,
    'publish_posts' => true,
    'edit_pages' => true,
    'read' => true,
    'level_7' => true,
    'level_6' => true,
    'level_5' => true,
    'level_4' => true,
    'level_3' => true,
    'level_2' => true,
    'level_1' => true,
    'level_0' => true,
    'edit_others_pages' => true,
    'edit_published_pages' => true,
    'publish_pages' => true,
    'delete_pages' => true,
    'delete_others_pages' => true,
    'delete_published_pages' => true,
    'delete_posts' => true,
    'delete_others_posts' => true,
    'delete_published_posts' => true,
    'delete_private_posts' => true,
    'edit_private_posts' => true,
    'read_private_posts' => true,
    'delete_private_pages' => true,
    'edit_private_pages' => true,
    'read_private_pages' => true,
  ),
))

#2 @ourakland
5 years ago

After trying different capabilities, I narrowed it down to edit_others_posts. If I add that to the author role, $_POST comes through unscathed to my save meta data function, and things work as as desired.

Of course, that causes a bunch of other problems (like authors being able to edit others' posts), but maybe can help narrow down where the problem is in the WP code.

#3 @Guido07111975
5 years ago

Seems to be fixed in WP 5.3?

#4 @Guido07111975
4 years ago

  • Keywords close added

#5 @Guido07111975
4 years ago

  • Keywords close removed
  • Resolution set to invalid
  • Status changed from new to closed

Is fixed, so closing this.

#6 @desrosj
4 years ago

  • Milestone Awaiting Review deleted
  • Severity changed from major to normal
Note: See TracTickets for help on using tickets.