Save 25% on our pro plugins with coupon code: SPRING2023
Web Dev + WordPress + Security

Execute External WordPress Functions

To execute WordPress functions in an external directory (i.e., outside of the WordPress install directory), it is necessary to include a call to wp-blog-header.php at the top of the external file.

For example, if your WordPress-powered blog is located in a subdirectory called “blog” and the external file is in the domain root (e.g., the external file is located directly in http://domain.com/), add the following code to the top of the external file:

<?php require_once("./blog/wp-blog-header.php"); ?>

Alternately, you can do this:

<?php require(dirname(__FILE__) .'/blog/wp-blog-header.php'); ?>

Jeff Starr
About the Author
Jeff Starr = Designer. Developer. Producer. Writer. Editor. Etc.
BBQ Pro: The fastest firewall to protect your WordPress.
Comments are closed for this post. Something to add? Let me know.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
BBQ Pro: The fastest firewall to protect your WordPress.
Thoughts
There is no end to what humans can achieve when they work together.
Excellent (and free) tool to test your site's SSL configuration.
Plugin updates! All of our free and pro plugins ready for WordPress 6.2.
Daylight savings is a complete waste of time and needs to be eliminated.
Got a couple of snow days here in mid-March. Fortunately it's not sticking.
I handle all email in real time as it comes in, perpetually clear inbox for years now.
Added some nice features to Wutsearch search engine launchpad. Now 21 engines!
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.