Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: add_trashed_suffix_to_trashed_posts

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
4029           /**
4030            * Filters whether or not to add a `__trashed` suffix to trashed posts that match the name of the updated post.
4031            *
4032            * @since 5.4.0
4033            *
4034            * @param bool   $add_trashed_suffix Whether to attempt to add the suffix.
4035            * @param string $post_name          The name of the post being updated.
4036            * @param int    $post_ID            Post ID.
4037            */
4038           $add_trashed_suffix = apply_filters( 'add_trashed_suffix_to_trashed_posts', true, $post_name, $post_ID );
4039
4040           if ( $add_trashed_suffix ) {
4041                wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID );
4042           }
4043      }
4044
4045      // When trashing an existing post, change its slug to allow non-trashed posts to use it.
4046      if ( 'trash' === $post_status && 'trash' !== $previous_status && 'new' !== $previous_status ) {
4047           $post_name = wp_add_trashed_suffix_to_post_name_for_post( $post_ID );