admin管理员组文章数量:1416333
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 );
本文标签: Hook createupdate post
版权声明:本文标题:Hook createupdate post 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745250184a2649776.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论