wp_add_trashed_suffix_to_post_name_for_trashed_posts

The timeline below displays how wordpress function wp_add_trashed_suffix_to_post_name_for_trashed_posts has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Adds a suffix if any trashed posts have a given slug.
 *
 * Store its desired (i.e. current) slug so it can try to reclaim it
 * if the post is untrashed.
 *
 * For internal use.
 *
 * @since 4.5.0
 * @access private
 *
 * @param string $post_name Post slug.
 * @param int    $post_id   Optional. Post ID that should be ignored. Default 0.
 */
function wp_add_trashed_suffix_to_post_name_for_trashed_posts($post_name, $post_id = 0)
{
    $trashed_posts_with_desired_slug = get_posts(array('name' => $post_name, 'post_status' => 'trash', 'post_type' => 'any', 'nopaging' => true, 'post__not_in' => array($post_id)));
    if (!empty($trashed_posts_with_desired_slug)) {
        foreach ($trashed_posts_with_desired_slug as $_post) {
            wp_add_trashed_suffix_to_post_name_for_post($_post);
        }
    }
}

WordPress Version: 5.9

/**
 * Adds a suffix if any trashed posts have a given slug.
 *
 * Store its desired (i.e. current) slug so it can try to reclaim it
 * if the post is untrashed.
 *
 * For internal use.
 *
 * @since 4.5.0
 * @access private
 *
 * @param string $post_name Post slug.
 * @param int    $post_ID   Optional. Post ID that should be ignored. Default 0.
 */
function wp_add_trashed_suffix_to_post_name_for_trashed_posts($post_name, $post_ID = 0)
{
    $trashed_posts_with_desired_slug = get_posts(array('name' => $post_name, 'post_status' => 'trash', 'post_type' => 'any', 'nopaging' => true, 'post__not_in' => array($post_ID)));
    if (!empty($trashed_posts_with_desired_slug)) {
        foreach ($trashed_posts_with_desired_slug as $_post) {
            wp_add_trashed_suffix_to_post_name_for_post($_post);
        }
    }
}

WordPress Version: 5.7

/**
 * Adds a suffix if any trashed posts have a given slug.
 *
 * Store its desired (i.e. current) slug so it can try to reclaim it
 * if the post is untrashed.
 *
 * For internal use.
 *
 * @since 4.5.0
 * @access private
 *
 * @param string $post_name Slug.
 * @param int    $post_ID   Optional. Post ID that should be ignored. Default 0.
 */
function wp_add_trashed_suffix_to_post_name_for_trashed_posts($post_name, $post_ID = 0)
{
    $trashed_posts_with_desired_slug = get_posts(array('name' => $post_name, 'post_status' => 'trash', 'post_type' => 'any', 'nopaging' => true, 'post__not_in' => array($post_ID)));
    if (!empty($trashed_posts_with_desired_slug)) {
        foreach ($trashed_posts_with_desired_slug as $_post) {
            wp_add_trashed_suffix_to_post_name_for_post($_post);
        }
    }
}

WordPress Version: 4.5

/**
 * Adds a suffix if any trashed posts have a given slug.
 *
 * Store its desired (i.e. current) slug so it can try to reclaim it
 * if the post is untrashed.
 *
 * For internal use.
 *
 * @since 4.5.0
 * @access private
 *
 * @param string $post_name Slug.
 * @param string $post_ID   Optional. Post ID that should be ignored. Default 0.
 */
function wp_add_trashed_suffix_to_post_name_for_trashed_posts($post_name, $post_ID = 0)
{
    $trashed_posts_with_desired_slug = get_posts(array('name' => $post_name, 'post_status' => 'trash', 'post_type' => 'any', 'nopaging' => true, 'post__not_in' => array($post_ID)));
    if (!empty($trashed_posts_with_desired_slug)) {
        foreach ($trashed_posts_with_desired_slug as $_post) {
            wp_add_trashed_suffix_to_post_name_for_post($_post);
        }
    }
}