Permalink
Browse files

Only update/delete liveblog postmeta when it's changing.

Otherwise we run update and delete whenever a post is saved.
  • Loading branch information...
1 parent 09e766c commit c9f98b5b3a63d3a3c5e09e156dee0b10c17a2076 @mjangda mjangda committed Sep 25, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 liveblog.php
View
@@ -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 );
}

0 comments on commit c9f98b5

Please sign in to comment.