Hook createupdate post

I'm creating an Event thanks to a plugin (Event plus).I need to alter the hook when the event is created, I tried w

I'm creating an Event thanks to a plugin (Event plus).

I need to alter the hook when the event is created, I tried with the native WP functions, but as WP (or the plugin ?) always create an ID for the post type (to save the draft automaticaly), the "updated" is always trigger.

I need to do some function if the event is a new, and some function if the event is an existing one. What should I change ?

    function wemap_update_create_event( $post_id, $post, $update ) {

    if ( wp_is_post_revision( $post_id ) )
        return;

    if($post->post_type == "incsub_event"){
        nice($post);
        //check if the post is in the database or not with get_post( $post_id ) == null
        if( get_post( $post_id ) == null ) {
            die("not in db");
        }
        if($update && get_post( $post_id ) != null) {

            die("update");
        }
    }
}
add_action( 'wp_insert_post', 'wemap_update_create_event', 10, 3 );

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745250184a4618631.html

相关推荐

  • Hook createupdate post

    I'm creating an Event thanks to a plugin (Event plus).I need to alter the hook when the event is created, I tried w

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信