Posts, Post Types: Introduce a filter which allows the addition of __trashed suffixes on post slugs to be skipped.

Fixes #46433
Built from https://develop.svn.wordpress.org/trunk@47203


git-svn-id: http://core.svn.wordpress.org/trunk@47003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2020-02-07 17:33:06 +00:00
parent aea25de893
commit 352ac8bf35
2 changed files with 15 additions and 2 deletions

View File

@ -3843,7 +3843,20 @@ function wp_insert_post( $postarr, $wp_error = false ) {
// If a trashed post has the desired slug, change it and let this post have it.
if ( 'trash' !== $post_status && $post_name ) {
wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID );
/**
* Filters whether or not to add a `__trashed` suffix to trashed posts that match the name of the updated post.
*
* @since 5.4.0
*
* @param bool $add_trashed_suffix Whether to attempt to add the suffix.
* @param string $post_name The name of the post being updated.
* @param int $post_ID Post ID.
*/
$add_trashed_suffix = apply_filters( 'add_trashed_suffix_to_trashed_posts', true, $post_name, $post_ID );
if ( $add_trashed_suffix ) {
wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID );
}
}
// When trashing an existing post, change its slug to allow non-trashed posts to use it.

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-47202';
$wp_version = '5.4-alpha-47203';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.