WordPress.org

Make WordPress Core

Ticket #46433: 46433.patch

File 46433.patch, 1.1 KB (added by johnbillion, 2 years ago)
  • src/wp-includes/post.php

    diff --git src/wp-includes/post.php src/wp-includes/post.php
    index 3874c503bb..4588cdc077 100644
    function wp_insert_post( $postarr, $wp_error = false ) { 
    36723672
    36733673        // If a trashed post has the desired slug, change it and let this post have it.
    36743674        if ( 'trash' !== $post_status && $post_name ) {
    3675                 wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID );
     3675                /**
     3676                 * Whether or not to attempt to add a `__trashed` suffix to trashed posts that match the name of the udpated post.
     3677                 *
     3678                 * @param bool   $add_trashed_suffix Whether to attempt to add the suffix.
     3679                 * @param string $post_name The name of the post being updated.
     3680                 * @param int    $post_ID Post ID.
     3681                 */
     3682                $add_trashed_suffix = apply_filters( 'add_trashed_suffix_to_trashed_posts', true, $post_name, $post_ID );
     3683
     3684                if ( $add_trashed_suffix ) {
     3685                        wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID );
     3686                }
    36763687        }
    36773688
    36783689        // When trashing an existing post, change its slug to allow non-trashed posts to use it.