Sean Breeden

Full Stack PHP, Python, AI/ML Developer
"The person who says it cannot be done should not interrupt the person doing it." --Unknown

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: 1226
| Home | Announcements | Artificial Intelligence | Commodore 64 | CraftCMS | Crypto | Games | Geek | Machine Learning | Magento | Memes | Science News | Security | 7 Days to Die | Ubuntu |