Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit permalink slug in Gutenberg post only possible after clicking "save as draft" #50469

Closed
raabmar opened this issue May 9, 2023 · 4 comments
Labels
[Package] Editor /packages/editor [Type] Enhancement A suggestion for improvement. [Type] WP Core Ticket Requires an upstream change from WordPress. Core Trac ticket should be linked.

Comments

@raabmar
Copy link

raabmar commented May 9, 2023

Description

The UX and workflow is different on post and pages when it comes to Gutenberg. It makes sense to be easily able to set the slug of a post before publishing. This is especially important when clients are adding post content. It must be made as obvious and easy as possible to them.

Posts with Gutenberg
Add a post with Gutenberg, you'll see you must save as draft first to be able to edit the slug

Posts with Classic Editor
Adding a post with Classic Editor enabled, will allow to set the permalink slug right away.

Page with Gutenberg
Not tested by myself, but got the information from the community. When editing pages with Gutenberg, the workflow is differently. It's possible to edit the slug right away. So it seem only with native posts this behaviour is incorrect.

Step-by-step reproduction instructions

  1. Add post
  2. Try to change permalink/slug before publishing or saving as draft

Expected behaviour
Similar to Classic Editor I am able to actually change the slug before saving/publishing

Actual behaviour
Must be saved as draft or published only then I can change the slug

Screenshots, screen recording, code snippet

No response

Environment info

WP 6.2

Tested by several ppl on different environments

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@andrewserong andrewserong added [Type] Enhancement A suggestion for improvement. [Package] Editor /packages/editor labels May 10, 2023
@andrewserong
Copy link
Contributor

Thanks for reporting this issue! I can reproduce the above behaviour locally:

  • In the page editor, it is possible to update the permalink prior to saving a draft / adding a title to the page
  • In the post editor, it is not possible to update the permalink prior to saving a draft

I'm not too sure the cause, but I found that by logging out some results within the isPermalinkEditable function, prior to saving a draft, the default permalink_template of a post uses the post id, however after saving, it winds up using the value used in site-wide settings for permalink structure. Here's a screenshot of logging out the value for permalinkTemplate before and after saving a post:

image

As for coming up with a fix, it sounds like it could be something to do with the initial state when the post editor is loaded? In core the post-new.php screen creates a default post here, but I can't see anywhere yet where there'd be a difference in permalink template values between post or page post types 🤔

@raabmar
Copy link
Author

raabmar commented May 10, 2023

@andrewserong Thanks for narrowing it down - I myself can't contribute much to it (time), I only noticed it and tried to understand it when I noticed it's behaving somehow bug-ish. Not sure how the bug tracking with Gutenberg works overall. Definitely it's an odd behaviour. And definitely this worked with the classic editor.

@youknowriad
Copy link
Contributor

Thanks for debugging a bit here. I tracked this further. The origin of this issue seem to be on WordPress Core. So I created the following trac ticket https://core.trac.wordpress.org/ticket/59283 and I proposed this PR to fix it WordPress/wordpress-develop#5138

The change is a bit low level though, so we'd some folks familiar with this area of the code to validate it.

@skorasaurus skorasaurus added the [Type] WP Core Ticket Requires an upstream change from WordPress. Core Trac ticket should be linked. label Sep 5, 2023
@youknowriad
Copy link
Contributor

Solved upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Editor /packages/editor [Type] Enhancement A suggestion for improvement. [Type] WP Core Ticket Requires an upstream change from WordPress. Core Trac ticket should be linked.
Projects
None yet
Development

No branches or pull requests

4 participants