WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

wp_add_trashed_suffix_to_post_name_for_post() WP 4.5.0

Adds a trashed suffix for a given post.

Store its desired (i.e. current) slug so it can try to reclaim it if the post is untrashed.

For internal use.

Хуков нет.

Возвращает

Строку. New slug for the post.

Использование

wp_add_trashed_suffix_to_post_name_for_post( $post );
$post(WP_Post) (обязательный)
The post.

Список изменений

С версии 4.5.0 Введена.

Код wp_add_trashed_suffix_to_post_name_for_post() WP 5.7

<?php
function wp_add_trashed_suffix_to_post_name_for_post( $post ) {
	global $wpdb;

	$post = get_post( $post );

	if ( '__trashed' === substr( $post->post_name, -9 ) ) {
		return $post->post_name;
	}
	add_post_meta( $post->ID, '_wp_desired_post_slug', $post->post_name );
	$post_name = _truncate_post_slug( $post->post_name, 191 ) . '__trashed';
	$wpdb->update( $wpdb->posts, array( 'post_name' => $post_name ), array( 'ID' => $post->ID ) );
	clean_post_cache( $post->ID );
	return $post_name;
}