Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#59283 new defect (bug)

Block Editor: Edit permalink slug for posts is only possible after clicking "save as draft"

Reported by: youknowriad's profile youknowriad Owned by:
Milestone: 6.4 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch
Focuses: Cc:


Originally posted in Gutenberg

When creating a new post using the block editor, it's impossible to set the permalink of the post before you actually save the first draft of the post. It's different for the page editor where you can do so before.

@andrewserong tracked this to the permalink_template property not being set on the initial request to fetch the auto-draft post.

Change History (3)

This ticket was mentioned in PR #5138 on WordPress/wordpress-develop by @youknowriad.

4 weeks ago

  • Keywords has-patch added

When loading the post editor the permalink_template property is not set properly on the post object (REST API) (it uses the plain post permalink instead of the pretty permalink). This causes the editor to not offer a way to edit the slug before actually saving the post which results in the permalink_template being set properly.

I tracked this down to get_sample_permalink and get_permalink return the plain permalink structure for auto-draft posts.

I'm not entirely certain about this fix as it's a bit low level, would appreciate a review from folks familiar with this.

@youknowriad commented on PR #5138:

4 weeks ago

I'm happy to add tests and all later, just want to check whether this is the right fix or if there's something else that we should be doing.

#3 @iamfarhan09
4 weeks ago


I'm interested in contributing to this issue. I can review the proposed code change and assist with testing. However, I'd appreciate some more context on how this change affects the editor and whether there are any specific testing scenarios to consider.

Looking forward to helping out.

Note: See TracTickets for help on using tickets.