Filter hook 'add_trashed_suffix_to_trashed_posts'

in WP Core File wp-includes/post.php at line 4728

View Source

add_trashed_suffix_to_trashed_posts

Filter Hook
Description
Filters whether or not to add a `__trashed` suffix to trashed posts that match the name of the updated post.

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Filter
Line Number 4728

Hook Parameters

Type Name Description
bool $add_trashed_suffix Whether to attempt to add the suffix.
string $post_name The name of the post being updated.
int $post_id Post ID.

Usage Examples

Basic Usage
<?php
// Hook into add_trashed_suffix_to_trashed_posts
add_filter('add_trashed_suffix_to_trashed_posts', 'my_custom_filter', 10, 3);

function my_custom_filter($add_trashed_suffix, $post_name, $post_id) {
    // Your custom filtering logic here
    return $add_trashed_suffix;
}

Source Code Context

wp-includes/post.php:4728 - How this hook is used in WordPress core
<?php
4723  		 *
4724  		 * @param bool   $add_trashed_suffix Whether to attempt to add the suffix.
4725  		 * @param string $post_name          The name of the post being updated.
4726  		 * @param int    $post_id            Post ID.
4727  		 */
4728  		$add_trashed_suffix = apply_filters( 'add_trashed_suffix_to_trashed_posts', true, $post_name, $post_id );
4729  
4730  		if ( $add_trashed_suffix ) {
4731  			wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_id );
4732  		}
4733  	}

PHP Documentation

<?php
/**
		 * 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.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.