From be65f752ec8c57d5719293c167c049daac1db50a Mon Sep 17 00:00:00 2001 From: Igor Rozum Date: Wed, 11 Nov 2026 11:55:04 -0500 Subject: [PATCH 1/2] Add e2e test for permalink display when post type lacks title support --- .../edit-post-without-title-support.test.js | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tests/e2e/specs/edit-post-without-title-support.test.js diff --git a/tests/e2e/specs/edit-post-without-title-support.test.js b/tests/e2e/specs/edit-post-without-title-support.test.js new file mode 100644 index 0000000000000..5654e95afa8ea --- /dev/null +++ b/tests/e2e/specs/edit-post-without-title-support.test.js @@ -0,0 +1,77 @@ +/** + * Internal dependencies + */ +import { test, expect } from '../fixtures'; + +const POST_TYPES_MU_PLUGIN = ` true, + 'label' => 'No Title CPT', + 'supports' => array( 'editor' ), + 'show_in_rest' => false, + ) + ); + register_post_type( + 'with_title_cpt', + array( + 'public' => true, + 'label' => 'With Title CPT', + 'supports' => array( 'title', 'editor' ), + 'show_in_rest' => false, + ) + ); + } +);`; + +test.describe( 'Edit post without title support', () => { + test.beforeEach( async ( { muPlugin } ) => { + await muPlugin.write( + 'post-types-title-support.php', + POST_TYPES_MU_PLUGIN + ); + } ); + + test( 'shows the permalink for a published post of a type that does not support titles', async ( { + admin, + page, + } ) => { + await admin.visitAdminPage( 'post-new.php', 'post_type=no_title_cpt' ); + await expect( page.locator( '#title' ) ).toHaveCount( 0 ); + + await page.locator( '#publish' ).click(); + await expect( page.locator( '#message.updated' ) ).toBeVisible(); + + const slugBox = page.locator( '#edit-slug-box' ); + await expect( slugBox ).toBeVisible(); + await expect( slugBox ).toContainText( 'Permalink:' ); + await expect( + slugBox.locator( '#sample-permalink a' ) + ).toHaveAttribute( 'href', /no_title_cpt/ ); + } ); + + test( 'still shows the title field and permalink for post types that support titles', async ( { + admin, + page, + } ) => { + await admin.visitAdminPage( + 'post-new.php', + 'post_type=with_title_cpt' + ); + await expect( page.locator( '#title' ) ).toBeVisible(); + + await page.locator( '#title' ).fill( 'Post with a title' ); + await page.locator( '#publish' ).click(); + await expect( page.locator( '#message.updated' ) ).toBeVisible(); + + const slugBox = page.locator( '#edit-slug-box' ); + await expect( slugBox ).toBeVisible(); + await expect( + slugBox.locator( '#sample-permalink a' ) + ).toHaveAttribute( 'href', /post-with-a-title/ ); + } ); +} ); From c25d228506ff2efc7d7413c47c7648386217fee9 Mon Sep 17 00:00:00 2001 From: Igor Rozum Date: Wed, 11 Nov 2026 11:55:04 -0500 Subject: [PATCH 2/2] Posts: Show the permalink in the classic editor when the post type does not support titles --- src/wp-admin/edit-form-advanced.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/edit-form-advanced.php b/src/wp-admin/edit-form-advanced.php index 8b1dd3d1f9604..e5176b2e86214 100644 --- a/src/wp-admin/edit-form-advanced.php +++ b/src/wp-admin/edit-form-advanced.php @@ -523,8 +523,8 @@
-
+
+
-