wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_add_trashed_suffix_to_post_name_for_post is private and should not be used in themes or plugins directly.
wp_add_trashed_suffix_to_post_name_for_post › WordPress Function
Since4.5.0
已弃用n/a
› wp_add_trashed_suffix_to_post_name_for_post ( $post )
| 访问: |
|
| 参数: |
|
| 返回: |
|
| 定义在: |
|
| 文档: |
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.源码
function wp_add_trashed_suffix_to_post_name_for_post( $post ) {
global $wpdb;
$post = get_post( $post );
if ( str_ends_with( $post->post_name, '__trashed' ) ) {
return $post->post_name;
}
add_post_meta( $post->ID, '_wp_desired_post_slug', $post->post_name );
$post_name = wp_truncate_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;
}