Last active
August 29, 2015 14:10
-
-
Save elimn/7f7874478c09638410ba to your computer and use it in GitHub Desktop.
MT | TEC | Fix Bug: Editted events do not change browsable date range of month view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Fixes bug in TEC 3.8 | |
// Edits of events will now update the month view browsable date range | |
function tribe_listen_for_event_updates() { | |
if ( class_exists( 'TribeEvents' ) ) | |
add_action( 'save_post_' . TribeEvents::POSTTYPE, 'tribe_force_update_event_date_range' ); | |
} | |
add_action( 'init', 'tribe_listen_for_event_updates' ); | |
function tribe_force_update_event_date_range( $post_id ) { | |
$public_states = array( 'publish', 'private', 'protected' ); | |
if ( ! in_array( get_post_status( $post_id ), $public_states ) ) return; | |
$callback = array( TribeEvents::instance(), 'rebuild_known_range' ); | |
add_action( 'update_post_meta', $callback, 10, 3 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment