Share Article To

In most of of the time while we are writing a plugin and doing some AJAX call into this we often including wp-load.php file. It is obvious that to access the WordPress core functions we need to established the WordPress environment. But some time it also happened that WordPress environment is already established though we are including the file which lead to decrease our site performance. So now the question is Check whether the WordPress environment loaded or not


So, it is batter to check whether the WordPress environment established or not before including the wp-load.php file.

So in future whenever you are going to include the wp-load.php file use below snippet.

if ( !defined('ABSPATH') ) {
/** Set up WordPress environment */
require_once('./wp-load.php');
}

‘ABSPATH’ constant is defined in wp-load.php file so if that constant is not defined then it is clear that the WordPress environment is not established yet.

Bonus Tip:  How to make placeholder work in IE browser

Leave a Reply

Your email address will not be published. Required fields are marked *