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

Navigation: Creating new page from within the linker shall set title and slug right away (currently sets numerical ID) #46731

Open
porg opened this issue Dec 22, 2022 · 3 comments
Labels
[Block] Navigation Link Affects the Navigation Link Block [Block] Navigation Affects the Navigation Block [Type] Enhancement A suggestion for improvement.

Comments

@porg
Copy link

porg commented Dec 22, 2022

In the mockup video by @shaunandrews one sees as the feature should work:

  1. In the linker you type in your word(s), e.g. "Our Story"
  2. In the results below the Combobox, you click the option "New Page: Our Story"
  3. The page get's created.
  • ✅ With the page/blogpost metadata title "Our Story".
  • ✅ With the h1 prefilled to "Our Story", you can choose to hide/remove/alter later if you want.
  • With the proper slug /our-story/
    - ✅ In the mockup video this is the case.
    - ❌ In WP 6.1.1 this is not the case, instead it get's created as /?page_id=1234
    • You then have to open the page, and edit the slug there manually.
    • The "ad-hoc link/page creation mode" is supposed to provide you a distraction-free working mode.
    • This unnecessary administrative burden destroys that again.
    • The slug should be created automatically.
@porg
Copy link
Author

porg commented Dec 22, 2022

#29395 would be fixed too by creating the slug right away too.

  • Does the Wordpress architecture allow to create the slug right away to reserve it in the namespace, but nevertheless not yet publish that page/blogpost automatically, but keeping it as a draft, as it is a skeleton only (title but nothing else)?
  • Even if not, I think it would be the right way.
  • Because if people are in the process of creating a website structure and not wanting to expose their website they can
    • run it locally or on a LAN,
    • keep it from web spiders of mainstream search engines which respect robots.txt with the built-in preference: Settings > Reading Settings > Search engine visibility > ☑︎ Discourage search engines from indexing this site
    • or keep the website login-only with a free plugin like My Private Site

👉 Quite many good reasons to create and reserve the slug right away.

@kathrynwp kathrynwp added [Block] Navigation Affects the Navigation Block [Type] Enhancement A suggestion for improvement. [Block] Navigation Link Affects the Navigation Link Block labels Dec 22, 2022
@getdave
Copy link
Contributor

getdave commented Nov 21, 2024

Thanks for your proposal.

  • Does the Wordpress architecture allow to create the slug right away to reserve it in the namespace, but nevertheless not yet publish that page/blogpost automatically, but keeping it as a draft, as it is a skeleton only (title but nothing else)?

I wonder if @anton-vlasenko or @ironprogrammer would know the answer to this?

I'll note that it's unlikely we'll be able to change the way WordPress Core works to accommodate a UX requirement of the Navigation block.

@anton-vlasenko
Copy link
Contributor

anton-vlasenko commented Nov 21, 2024

Does the Wordpress architecture allow to create the slug right away to reserve it in the namespace, but nevertheless not yet publish that page/blogpost automatically, but keeping it as a draft, as it is a skeleton only (title but nothing else)?
I wonder if @anton-vlasenko or @ironprogrammer would know the answer to this?

Yes, I agree with @getdave.
As far as I know, there is no "reliable" way to reserve a slug in WordPress.
When publishing a post, WordPress checks if other posts, including drafts, already use the same slug. If a conflict is found, WordPress appends a numeric suffix (e.g., -2, -3, etc.) to create a unique slug for the new post.
However, if the current draft has a slug not used by other posts, WordPress will use that slug when publishing the post.

In summary, slug names aren’t finalized until the post is published, which is when WordPress officially assigns the slug.
Inspecting the source code of the wp_unique_post_slug() function might provide more insight into the specific details of the slug assignment mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Link Affects the Navigation Link Block [Block] Navigation Affects the Navigation Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants