I'm curious about the proper way to prevent the user from activating their plugin if their system does not meet certain requirements It is easy to check and I do not need any help about it, I have more curiosity to ask how to exit WordPress and display an error message.
Currently I have both the Does anyone have a better Ways to know, which will display in a proper error box without displaying my error, it seems to be very bad for new people only is that the user to see it Dirname (__ file__). '/functions.php'; Deactivate_plugins ($ plugin); WordPress 2.8 or greater for Wp_die ('& lt; p & gt; Strong & gt; X & lt; / strong & gt; Plugin is required. & Lt; / p & gt;', plugin Activation error ', array (' response '=> 200,' back_link '= & gt; TRUE); wp_die () The above lines are to disable this plugin, note that we use functions.php in this case because this is where I have the plugin name meta data comment The announcement is - and if you use a different file, replace the above code. Note that the path is very specific for a match. Therefore, if you want to see what your path would normally be like, then use Note that wp_die () The end of the statement is important because it provides a backlink and error 500 (which is for wp_die ()) Prevents Fault Apache code). exit ($ error_message) and
die ($ error_message) in the activation hook method while my message is displayed and the plugin is not active That is, a message says that fatal error is also displayed (see picture below).
print_r ('active_plugins'); die (); Since I had plugin_ code.php where my The plugin code was remaining, and because this function was in the same directory as .php, I had to do
dirname (__ file __) for the appropriate code
Comments
Post a Comment