Code like this can do the trick.
function plugin_activation_check(){
if ( some_check_here() ) {
// this is the fail case
deactivate_plugins(basename(__FILE__)); // Deactivate ourself
wp_die("Message to user.");
}
}
register_activation_hook(__FILE__, 'plugin_activation_check');
Related Posts:
- Uninstall, Activate, Deactivate a plugin: typical features & how-to
- Loading external page template and enqueue script from plugin causes 403 forbidden error
- How to get Login Error messages on a custom template
- Function to activate WordPress theme inside a plugin
- Activate Plugin which is in subfolder?
- WordPress register_activation_hook table creation not working
- Correct way to use register_activation_hook
- Unable to activate wordpress importer after installing it
- Auto add content such as pages upon plugin activation?
- How to automate wordpress plugin activate and deactivate by php logic?
- Accessing GET variable named ‘error’
- Default Plugin Settings Not Writing to Database
- Own plugin corrups plugin-activation
- CSV file generation failing
- Python with wordpress plugin
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- Force file download on plugin activation
- Run function on plugin activation before plugin is loaded
- WordPress error: Options page Setting_ not found in the allowed options list
- Apparent errer when installing plugin
- My plugin does not install correctly if a previous version is still installed
- Activation flow of a plugin in a multisite environment
- How to check for already existing plugin versions on activation? and prevent errors
- My WordPress activation hook isn’t working
- Cannot modify header information – headers already sent during plugin activation
- How do I create a state of “don’t assign anything to variable” if WP_Error throws an error?
- A more elegant way to handle notices/warnings
- The plugin generated xxx characters of unexpected output during activation
- How can I send api calls from my plugin?
- How can I find plugins’ slug?
- My custom made plugin has “a new version available” which links to unrelated plugin
- wp.media update options and force render on uploader
- How to remove duplicate sub-menu name for top level menu items in a plugin?
- WordPress Plugin Development from Scratch. How? [closed]
- How to fetch serialized data from wordpress options
- Passing URL parameters to WordPress pages and pretty url
- WordPress network: set themes and plugins for new blog
- How to get the custom page get_permalink?
- Plugin translations problem
- Advanced Custom Fields into functions.php
- How ( and mostly at what time ) can i prevent the alternate cron from running?
- What is the function to get plugin base url in multisite?
- PDF download – use wordpress functions
- How to call bind function in wordpress actions or hooks
- WordPress plugin for mail subscriptions [closed]
- Passing RichText attributes to function onChange
- Getting media library popup in custom plugin admin page
- How to remove the woocommerce_checkout_process action hook in woocommerce if particular project in cart [closed]
- WordPress Automatic Plugin Update Renames Plugin Directory
- ‘wp_login’ action hook not working with wp-login.php file
- HTML in WooCommerce settings
- Can WordPress Plugin Directory Cache Delay the Upload of Images?
- Redirecting to home page after login as custom role WordPress
- Where (or when) should I register a new taxonomy?
- How to change custom post type pemalink Hierarcy
- Fixing WordPress’s Bug (failed to send buffer of zlib output compression) results in “White Screen of Death”
- Disable woocommerce cookies and delete cart data automatically
- Consolidate plugin functionality into a theme
- qTranslate remove default directory from link
- Count posts by type including drafts and pending posts
- List the authors that have written posts in a category
- My custom plugin did not create db tables in database
- WordPress Multisite: Programmatically Activate / Deactivate a Plugin of a Specific Blog
- composer not working on my plugin when i upload it to my website
- What is the WordPress approach to custom data?
- WordPress Fatal Errors [closed]
- YOAST Seo xmlsitemap menu item not showing in the dashboard [closed]
- Plugin showing error
- Possible?? Pull Plugin Property Data to a Theme’s Custom Post Type
- How to rewrite URL and get the values?
- Problem after updating plugins
- Disable plugin visibility at the plugin directory
- Plugin is creating posts twice
- Undefined index: ratings_score …/wp-postratings.php on line 994
- How do I reliably find a URL to a script or other file?
- Error activating certain plugins
- Widgets are not displaying in the admin panel
- How to overwrite the category template in a plugin
- Content-Security-Policy implementation with WordPress W3Total Cache plugin installed
- Fixed: Console.log twice in the edit function
- show wc_add notices on particular page in woo commerce custom plugin development
- How to write different events from different functions in my file to a log file in WordPress
- Create a form and have custom menu display based on user answers?
- How to make a plugin api route have permission?
- Function settings_fields() not recognized (Uncaught Error: Call to undefined function settings_fields())
- Why my multisite is this slow? (stats inside)
- How to use custom footer template in a site-plugin?
- Problem with conditional woocommerce custom checkout field
- trying to create simple plugin to filter categories from all authors
- Change wp_mail SMTP settings for each E-Mail
- Proper Failure of Plugin Activation
- WordPress Thumbnail add action if no thumbnail
- How can I add the custom taxonomy categories to the posts and pages?
- Pass strings to plugin function [closed]
- WordPress Customer Reviews Error: Line 239?
- How to create a page template using custom plugin
- WordPress 3,5 and Jquery version
- how to search through plugin in wordpress cimy-user-extra-fields?
- contact form 7 captcha support anyother captcha plugin? [closed]
- How to add custom html to the Media > Attachment Details modal?