before_delete_post

最后更新于:2021-11-25 21:26:00

do_action( ‘before_delete_post’, int $postid, GC_Post $post )

Fires before a post is deleted, at the start of gc_delete_post().

参数

$postid

(int)
Post ID.

$post

(GC_Post)
Post object.

源文件

文件: gc-includes/post.php

View on Trac

<?php
add_action( 'before_delete_post', 'gcdocs_my_func' );
function gcdocs_my_func( $postid ) {

    // We check if the global post type isn't ours and just return
    global $post_type;   

    if ( 'gcdocs_my_custom_post_type' !== $post_type ) {
        return;
    }

    // My custom stuff for deleting my custom post type here
}
?>