delete_post

delete_post

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

See hook in core

Displaying hooks found in version: wordpress-6.7.2

do_action('delete_post') is found 2 times:

  • /wp-includes/post.php line 3783
    3779
    3780
    3781
    3782
    3783
    3784
    3785
    3786
    3787
    3788
    *
     * @param int     $post_id Post ID.
     * @param WP_Post $post    Post object.
     */
    do_action( 'delete_post', $post_id, $post );
     
    $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
    if ( ! $result ) {
        return false;
    }
  • /wp-includes/post.php line 6625
    6621
    6622
    6623
    6624
    6625
    6626
    6627
    6628
    6629
    6630
    6631
        delete_metadata_by_mid( 'post', $mid );
    }
     
    /** This action is documented in wp-includes/post.php */
    do_action( 'delete_post', $post_id, $post );
    $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
    if ( ! $result ) {
        return false;
    }
    /** This action is documented in wp-includes/post.php */
    do_action( 'deleted_post', $post_id, $post );

See this hook used in plugins: