Skip to content

Author field is required in Gutenberg for Custom Post Type #17073

@stuartshields

Description

@stuartshields

So currently when you create a Custom Post Type and are using Gutenberg, when a post is saved the post_author field in the database for that post is 0. This does not happen in the classic editor or revisions.

Steps to reproduce

  1. Create a custom post type using register_post_type
  2. Create a new post for the new custom post type
  3. Check database table *_posts
  4. post_author field is 0

Confirmed this has been happening in all versions of Gutenberg.

Short term solution
When creating the custom post type make sure to add author is added to supports and this will add the author id to the post.

Because of this we should also update the documentation for Gutenberg when using Custom Post Types.

Long term solution
Because Post and Page automatically add the author id to the post_author column in the database when using Gutenberg, we should also make this happen for Custom Post Types, as this the case with the classic editor.

Let me know if you need anymore information on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    REST API InteractionRelated to REST API[Type] WP Core TicketRequires an upstream change from WordPress. Core Trac ticket should be linked.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions