Wrong generated page_name/slug on first publish of custom post type
I have set up a custom post type (CPT) with the support for editor removed:
register_post_type( 'review', array( 'label' => 'Reviews', 'labels' => array( 'name' => 'Reviews', /* etc */ ), 'description' => 'Tour reviews', 'menu_icon' => 'dashicons-format-chat', 'public' => true, 'supports' => array( 'title', 'revisions', 'author', ), 'has_archive' => false, 'show_in_rest' => true, 'rewrite' => array('slug' => 'reviews'), ));
(Yes, I’m using only the title for content 😉 )
This works fine! However…
When I add a new post of this type, the auto-generated permalink has the slug of another post type’s title instead of using the added post type’s title.
So it produces:
Strangely, the “reviews” part is correct, but the
page_name part isn’t.
Is this a bug or am I missing something?
NB: If I add support for
editor in the
register_post_type call, this problem doesn’t occur. But I don’t want the editor enabled for this post type.
NB2: After first publish, if I manually empty the permalink’s edit field and click “Update”, the correct slug/
page_name is generated.