Commit f37b810036 for wordpress.org
commit f37b810036a30570f1589465092e3210c9684e15
Author: Sergey Biryukov <sergeybiryukov.ru@gmail.com>
Date: Mon Dec 8 21:55:34 2025 +0000
Posts, Post Types: Only set default title for custom post types if they have title support.
Previously, the default post title was always set to `Auto Draft`, regardless of whether the CPT supports a title.
This commit ensures that the default title is present when a CPT has title support, and is an empty string otherwise.
Follow-up to [12987], [49288], [49614].
Props SirLouen, rajanit2000, garrett-eclipse, wildworks, nrqsnchz, donmhico, marybaum, audrasjb, bridgetwillard, TimothyBlynJacobs, joyously, hellofromTonya, helen, Cybr, mosescursor, fakhriaz, gulamdastgir04, peterwilsoncc, mindctrl, westonruter, SergeyBiryukov.
Fixes #45516.
Built from https://develop.svn.wordpress.org/trunk@61360
git-svn-id: http://core.svn.wordpress.org/trunk@60672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index 97345331de..ab8fb62a7b 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -764,7 +764,7 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
if ( $create_in_db ) {
$post_id = wp_insert_post(
array(
- 'post_title' => __( 'Auto Draft' ),
+ 'post_title' => post_type_supports( $post_type, 'title' ) ? __( 'Auto Draft' ) : '',
'post_type' => $post_type,
'post_status' => 'auto-draft',
),
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 48da05cb44..8fdd8f4442 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.0-alpha-61359';
+$wp_version = '7.0-alpha-61360';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.