Make WordPress Core


Ignore:
Timestamp:
12/08/2025 09:53:05 PM (9 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/post.php

    r60701 r61360  
    765765                $post_id = wp_insert_post(
    766766                        array(
    767                                 'post_title'  => __( 'Auto Draft' ),
     767                                'post_title'  => post_type_supports( $post_type, 'title' ) ? __( 'Auto Draft' ) : '',
    768768                                'post_type'   => $post_type,
    769769                                'post_status' => 'auto-draft',
Note: See TracChangeset for help on using the changeset viewer.