Publish vs Update

Hi,
I have an autoposter that differentiate when a post is newly published (publish wordpress button) and updated (update wordpress button). It doesn’t autopost when it’s an update and it’s the way I want it to react. Problem is when I update a post with BB (publish BB button) it’s seen by the plugin as a published post not an update therefore it pushes it to buffer to be posted on social networks. The plugin is “wp to buffer”
Any Idea?
Thanks

Hey Mohammed,

Just letting you know that we are looking into this and will get back to you shortly.

Thanks!

KC

Hey Mohammed,

Just letting you know I’ve already submitted a bug report for this. :slight_smile:

Ben

Hey Mohammed,

Unfortunately, it looks like this is a core WordPress issue. We’re actually using wp_update_post, which calls wp_insert_post, which eventually calls wp_transition_post_status in wp-includes/post.php and is causing the issue. That function has the following…

do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );

… which fires regardless of if the post is actually being transitioned to a new post status or not. I believe that should be wrapped in an if statement to prevent this like so…

if ( $new_status != $old_status ) {
    do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );
}

The use of wp_update_post is pretty standard and will cause this issue with any plugin using it. The plugin author should consider posting an issue in WordPress Trac. Sorry I don’t have a better answer. I’d be happy to discuss further if needed.

Thanks,
Justin