Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shoreline-chrism/f8e172178e47e7a12c3ca318a6f4f7d5 to your computer and use it in GitHub Desktop.
Save shoreline-chrism/f8e172178e47e7a12c3ca318a6f4f7d5 to your computer and use it in GitHub Desktop.
Disable updates for event-tickets and event-tickets plus plugins in Wordpress. These plugins should be in-sync and since the plus version is paid it doesn't auto update like event-tickets plugin.
<?php
/**
* The event-tickets and event-tickets-plus plugins must be in-sync and the same
* version number, so let's not update event-tickets plugin unless our paid plugin
* is later than 4.2.7
*
* https://gist.github.com/shoreline-chrism/f8e172178e47e7a12c3ca318a6f4f7d5
*
*/
if ( !function_exists( 'shoreline_event_tickets_plugin_disable_updates' ) ) {
function shoreline_event_tickets_plugin_disable_updates( $value ) {
// Check that both plugins are active
if ( class_exists( 'Tribe__Events__Main', false ) && class_exists( 'Tribe__Tickets_Plus__Main', false )
// Make sure event-ticket-plus is the older version that we have license for
&& version_compare( Tribe__Tickets_Plus__Main::VERSION, '4.2.7', '<=' ) >= 0
// If both plugins are the same version number, remove both from auto update
&& version_compare(Tribe__Events__Main::VERSION, Tribe__Tickets_Plus__Main::VERSION, '=') >= 0
) {
unset( $value->response['event-tickets/event-tickets.php'] );
unset( $value->response['event-tickets-plus/event-tickets-plus.php'] );
}
return $value;
}
add_filter( 'site_transient_update_plugins', 'shoreline_event_tickets_plugin_disable_updates' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment