wp_is_post_autosave does not work
-
Hi there,
I want to auto publish all articles of my WP blog on Facebook without using any plugin.I wrote some code, and it works… but now I need to invoke this code only when I publish a new article (not for revisions or autosave).
That’s the code structure:
add_action( 'save_post', 'koolmind_facebook_post_article',3 ); function koolmind_facebook_post_article( $post_id ) { /* configuration of facebook params */ .... .... /* end config */ if ( !wp_is_post_revision( $post_id ) && !wp_is_post_autosave( $post_id ) ) { /* retrieve some data to publish */ /* invoke my code to publish on facebook */ } }
Problem is that my code is invoked as soon as I click on “add new article”, and an empty draft is sent to my Facebook page. Then, as soon as I insert a single char on my article body, autosave is triggered and a new post is sent again to facebook.
How can I avoid this behaviour? I need to call FB code only clicking on PUBLISH button.
Is that possibile?? I’m sure it is!
thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘wp_is_post_autosave does not work’ is closed to new replies.