mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Posts, Post Types: Set better default title for custom post types without title support.
The default title is now set to "(no title supported)" instead of "Auto Draft". Props garrett-eclipse, rajanit2000, bridgetwillard, donmhico, nrqsnchz. Fixes #45516. Built from https://develop.svn.wordpress.org/trunk@49288 git-svn-id: http://core.svn.wordpress.org/trunk@49050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
36d58abc8e
commit
d9838eed62
@ -680,9 +680,15 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
|
||||
}
|
||||
|
||||
if ( $create_in_db ) {
|
||||
if ( post_type_supports( $post_type, 'title' ) ) {
|
||||
$default_title = __( 'Auto Draft' );
|
||||
} else {
|
||||
$default_title = __( '(no title supported)' );
|
||||
}
|
||||
|
||||
$post_id = wp_insert_post(
|
||||
array(
|
||||
'post_title' => __( 'Auto Draft' ),
|
||||
'post_title' => $default_title,
|
||||
'post_type' => $post_type,
|
||||
'post_status' => 'auto-draft',
|
||||
),
|
||||
@ -690,9 +696,14 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
|
||||
true
|
||||
);
|
||||
$post = get_post( $post_id );
|
||||
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) ) {
|
||||
|
||||
if ( current_theme_supports( 'post-formats' )
|
||||
&& post_type_supports( $post->post_type, 'post-formats' )
|
||||
&& get_option( 'default_post_format' )
|
||||
) {
|
||||
set_post_format( $post, get_option( 'default_post_format' ) );
|
||||
}
|
||||
|
||||
wp_after_insert_post( $post, false );
|
||||
|
||||
// Schedule auto-draft cleanup.
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.6-beta1-49287';
|
||||
$wp_version = '5.6-beta1-49288';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user