timothyjensen
5/31/2016 - 5:52 PM

Checks if the Genesis Framework is active. If not, it deactivates the plugin.

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' );