
StackOverflow question answered: How to include WordPress functions in custom .php file?
I answered this question on StackOverflow way back in March 2013 and it still gets views and upvotes today.
The question:

My answer:

If you've found this page because you're looking at a way to include Wordpress in an external PHP file, then this is your lucky day! The answer is:
$path = "/home/yourhome/public_html/wp"; // <--- This is the path to your Wordpress installation. require_once($path . "/wp-load.php");