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
评论列表(0条)