Make WordPress Core

Changeset 57853


Ignore:
Timestamp:
03/19/2024 09:31:23 AM (3 months ago)
Author:
swissspidy
Message:

Posts, Post Types: Introduce delete_post_{$post->post_type} and deleted_post_{$post->post_type} hooks.

The hooks fire before the general delete_post / deleted_post hooks and have the same parameters.

They complement the save_post_{$post->post_type} hook added in [25050] and the edit_post_{$post->post_type} hook added in [43617].

Props benniledl, swissspidy, dargus.
Fixes #60433.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r57845 r57853  
    35563556     * Fires immediately before a post is deleted from the database.
    35573557     *
     3558     * The dynamic portion of the hook name, `$post->post_type`, refers to
     3559     * the post type slug.
     3560     *
     3561     * @since 6.6.0
     3562     *
     3563     * @param int     $postid Post ID.
     3564     * @param WP_Post $post   Post object.
     3565     */
     3566    do_action( "delete_post_{$post->post_type}", $postid, $post );
     3567
     3568    /**
     3569     * Fires immediately before a post is deleted from the database.
     3570     *
    35583571     * @since 1.2.0
    35593572     * @since 5.5.0 Added the `$post` parameter.
     
    35683581        return false;
    35693582    }
     3583
     3584    /**
     3585     * Fires immediately after a post is deleted from the database.
     3586     *
     3587     * The dynamic portion of the hook name, `$post->post_type`, refers to
     3588     * the post type slug.
     3589     *
     3590     * @since 6.6.0
     3591     *
     3592     * @param int     $postid Post ID.
     3593     * @param WP_Post $post   Post object.
     3594     */
     3595    do_action( "deleted_post_{$post->post_type}", $postid, $post );
    35703596
    35713597    /**
Note: See TracChangeset for help on using the changeset viewer.