While developing a plugin, you might want to display error messages if something went terribly wrong such as if the user’s version of PHP is too old. You can use WordPress built-in function wp_die()
, which creates a better looking error message, in which we can provide helpful links etc.
The function wp_die() is designed to give output just before it dies to avoid empty or time-outing responses.
Instructions:
Place it in your plugin’s code wherever you want to stop the plugin and show an error message.
<?php wp_die( __("Your PHP version isn't up-to-date, please <a href='http://php.net'>update</a>.") ); ?>
[code]update.") ); ?>[/code]
Comments Leave a Reply