Skip to content

Instantly share code, notes, and snippets.

@timothyjensen
Created May 31, 2016 17:52
Show Gist options
  • Save timothyjensen/e70cce23c881f3c554e80d15d26a5390 to your computer and use it in GitHub Desktop.
Save timothyjensen/e70cce23c881f3c554e80d15d26a5390 to your computer and use it in GitHub Desktop.
Checks if the Genesis Framework is active. If not, it deactivates the plugin.
<?php
/**
* This function is triggered when the WordPress theme is changed.
* It checks if the Genesis Framework is active. If not, it deactivates the plugin.
*
* @since 1.0
* @author Chimnoy Paul
*/
function gcfws_plugin_deactivate() {
if ( ! function_exists( 'genesis' ) ) {
// Deactivate.
deactivate_plugins( plugin_basename( __FILE__ ) );
add_action( 'admin_notices', 'gcfws_admin_notice_message' );
}
}
add_action( 'admin_init', 'gcfws_plugin_deactivate' );
add_action( 'switch_theme', 'gcfws_plugin_deactivate' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment