Hi, is there a way to execute a piece of code from a plugin only the very first time a post record is created?
(corresponding to $update being TRUE in wp_insert_post() in function-post.php)
Hi, is there a way to execute a piece of code from a plugin only the very first time a post record is created?
(corresponding to $update being TRUE in wp_insert_post() in function-post.php)
OK, the following seems to work. Is this the right way of doing it?
add_action('save_post','sd2_save_post');
function sd2_save_post($id){
if($_POST['prev_status'] == 'draft'){
// this post is just being created
Do you want it when it is PUBLISHED or when it is actually CREATED?
This topic has been closed to new replies.