Skip to content

Instantly share code, notes, and snippets.

@elimn
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elimn/7f7874478c09638410ba to your computer and use it in GitHub Desktop.
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
<?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