Here’s a quick tip which allows you to use a WordPress functions outside the WordPress architecture i.e inside a custom PHP file. In order, to achieve this goal you need to require a file called wp-load.php. This file is located at the root directory of your WordPress installation.
Quick Tip : How to Add Custom Body Class in WordPress?
<?php require_once('/path_to/wp-load.php'); ?>
Note: Including wp-load.php is not recommended. Click here to know why?