WordPress has proved to be one of the best platform for Developers and it provides a complete package for building a full Website. But sometimes we developers may need to add one or more custom PHP pages for various reasons.
Suppose you have a template file for your contact page and you built a custom form which when submitted will direct to send-contact-mail.php file and then that file will be used for form data manipulation and send mail. Here, you can easily use the php mail() function easily and achieve your goal but what if you want to use the WordPress actions in the file?
By default, your send-contact-mail.php is not recognized by WordPress and you cannot use any of the WordPress functions like get_bloginfo(‘url’); or in our case wp_mail(); function.
So What Do We Do?
The solution is quite easy. All we need is to include the wp-load.php file in our custom php page. The wp-load.php is location in the root of the site and it will make your custom php file compatible with WordPress functions.
However, there are many critics on including wp-load.php file. When you don’t know where the wp-load.php file is, it creates problem when including the file.
For more detailed information you can visit