Last active
June 22, 2017 20:56
-
-
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.
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 | |
/** | |
* 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