Mastodon
"I must not fear. Fear is the mind-killer..." --Bene Gesserit Litany Against Fear

StackOverflow question answered: How to include WordPress functions in custom .php file?

Tuesday, May 11th, 2021

profile for seanbreeden on Stack Exchange, a network of free, community-driven Q&A sites

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");

Views: 860