wp_trash_post

wp_trash_post

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.5.2

do_action('wp_trash_post') is found 2 times:

  • /wp-includes/class-wp-customize-manager.php line 3091
    			return $check;
    		}
    
    		/** This action is documented in wp-includes/post.php */
    		do_action( 'wp_trash_post', $post_id, $previous_status );
    
    		add_post_meta( $post_id, '_wp_trash_meta_status', $previous_status );
    		add_post_meta( $post_id, '_wp_trash_meta_time', time() );
    
    		$new_status = 'trash';
    		$wpdb->update( $wpdb->posts, array( 'post_status' => $new_status ), array( 'ID' => $post->ID ) );
    
  • /wp-includes/post.php line 3694
    	 *
    	 * @param int    $post_id         Post ID.
    	 * @param string $previous_status The status of the post about to be trashed.
    	 */
    	do_action( 'wp_trash_post', $post_id, $previous_status );
    
    	add_post_meta( $post_id, '_wp_trash_meta_status', $previous_status );
    	add_post_meta( $post_id, '_wp_trash_meta_time', time() );
    
    	$post_updated = wp_update_post(
    		array(
    

See this hook used in plugins: