Skip to content

Commit

Permalink
Only update/delete liveblog postmeta when it's changing.
Browse files Browse the repository at this point in the history
Otherwise we run update and delete whenever a post is saved.
  • Loading branch information
mjangda committed Sep 25, 2012
1 parent 09e766c commit c9f98b5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions liveblog.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,10 +661,15 @@ public function save_meta_box( $post_id ) {
if ( empty( $_POST[self::nonce_key] ) || ! wp_verify_nonce( $_POST[self::nonce_key], self::nonce_key ) )
return;

if ( ! empty( $_POST['is-liveblog'] ) ) {
if ( wp_is_post_revision( $post_id ) )
return;

$is_liveblog = self::is_liveblog_post( $post_id );

if ( ! empty( $_POST['is-liveblog'] ) && ! $is_liveblog ) {
update_post_meta( $post_id, self::key, 1 );
do_action( 'liveblog_enable_post', $post_id );
} else {
} elseif ( empty( $_POST['is-liveblog'] ) && $is_liveblog ) {
delete_post_meta( $post_id, self::key );
do_action( 'liveblog_disable_post', $post_id );
}
Expand Down

0 comments on commit c9f98b5

Please sign in to comment.