Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Created June 27, 2018 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/ad7db4f594d2c1b1d288c1ae67844654 to your computer and use it in GitHub Desktop.
Save Shelob9/ad7db4f594d2c1b1d288c1ae67844654 to your computer and use it in GitHub Desktop.
<?php
if (!version_compare(PHP_VERSION, '5.6.0', '>=')) {
function slug_php_version_nag()
{
?>
<div class="notice notice-error">
<p>
<?php _e('Your version of PHP is incompatible with YOUR PLUGIN and can not be used.', 'caldera-forms'); ?>
<?php printf(' <a href="https://your-plugin.com/php?utm_source=wp-admin&utm_campaign=php_deprecated&utm_source=admin-nag" target="__blank">%s</a>',
esc_html__('Learn More', 'slug')
) ?></p>
</div>
<?php
}
add_action('admin_notices', 'slug_php_version_nag');
}
=== Your plugin ===
Contributors: Shelob9
Tags: hi-oy
Requires at least: 4.7
Tested up to: 4.9.7
Stable tag: 1.7.2
License: GPLv2
Requires PHP: 5.6
@cliffordp
Copy link

Hey, Josh. I saw this gist embedded at https://torquemag.io/2018/08/how-to-drop-legacy-php-support-in-wordpress-plugins/

For those who copy/paste without reading first, please change that License to add or any later version -- better yet, GPL version 3 or any later version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment