Skip to content

Instantly share code, notes, and snippets.

@khromov
Created March 30, 2015 15:36
Show Gist options
  • Select an option

  • Save khromov/6455302c6e3ca826b093 to your computer and use it in GitHub Desktop.

Select an option

Save khromov/6455302c6e3ca826b093 to your computer and use it in GitHub Desktop.
How to kill WordPress plugin during activation if it's not compatible with the environment
<?php
/* Activation hook */
register_activation_hook( __FILE__, function() {
if(!function_exists('\get_field')) {
deactivate_plugins(__FILE__);
wp_die("Please enable Advanced Custom Fields before activating this plugin.");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment