From d16b60357a2e9990205e7423fa67ebb4c1d58b0f Mon Sep 17 00:00:00 2001 From: ramon Date: Fri, 6 Dec 2024 19:54:55 +1100 Subject: [PATCH] WordPress will try to create a slug from the title. WordPress will also look for a corresponding page- template that matches the slug name. Therefore if a page template exists with the name page-no-title, WordPress will apply that template to any page with that unique slug. This causes unexpected template assigment. TT4 and TT5 most notably. It's also inconsistent since subsequent untitled pages created in the site editor will use the default template, slugs being unique. Anyway, let's just use WordPress's default behavior, which is to create a unique slug using wp_unique_post_slug if none exists. --- packages/edit-site/src/components/add-new-post/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/edit-site/src/components/add-new-post/index.js b/packages/edit-site/src/components/add-new-post/index.js index 04e286e3967a4..ca0c7e1cd8e98 100644 --- a/packages/edit-site/src/components/add-new-post/index.js +++ b/packages/edit-site/src/components/add-new-post/index.js @@ -45,7 +45,6 @@ export default function AddNewPostModal( { postType, onSave, onClose } ) { { status: 'draft', title, - slug: title || __( 'No title' ), content: !! postTypeObject.template && postTypeObject.template.length