Forum Replies Created

Viewing 1 replies (of 1 total)
  • The problem I found was within this code :

    if ( wp_is_post_revision( $post_id )   ) {
    	return;
    }
    
    //if post is being saved as a draft, dont proceed
    if(isset($_POST["save"]) && $_POST["save"] == "Save Draft") {
    	return;
    }
    
    //if new post then dont proceed
    if(get_post_status( $post_id ) == "auto-draft") {
    	return;
    }

    The plugin didn’t take into account that my WP was not in english. So instead of having $_POST["save"] == "Save Draft", I had $_POST["save"] == "Enregistrer brouillon".

    I changed the code to this and it seems to work fine. If the post status isn’t set to “publish”, I don’t want to push it to Facebook.

    if ( wp_is_post_revision( $post_id ) || get_post_status( $post_id ) == "auto-draft" ) {
    	return;
    }
    
    //if post is being saved as a draft, dont proceed
    if(isset($_POST["save"]) && $_POST["save"] == "Save Draft") {
    	return;
    }
    
    //if status not "publish" then dont proceed
    if(get_post_status( $post_id ) != "publish") {
    	return;
    }
Viewing 1 replies (of 1 total)