Skip to content

Instantly share code, notes, and snippets.

@j-cam
Created April 12, 2016 04:55
Show Gist options
  • Save j-cam/3914e5479e6793f92f22842bd1c423ca to your computer and use it in GitHub Desktop.
Save j-cam/3914e5479e6793f92f22842bd1c423ca to your computer and use it in GitHub Desktop.
<?php
if ( !function_exists( 'get_home_path' ) )
require_once( dirname(__FILE__) . '/../../../wp-admin/includes/file.php' );
add_action( 'admin_init', array(&$this, 'has_acf') );
public function has_acf() {
if ( is_admin() && current_user_can( 'activate_plugins' ) && !is_plugin_active( 'advanced-custom-fields-pro/acf.php' ) ) {
add_action( 'admin_notices', array(&$this, 'acf_not_activated_notice') );
deactivate_plugins( plugin_basename( __FILE__ ) );
if ( isset( $_GET['activate'] ) ) {
unset( $_GET['activate'] );
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment