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'); ?>
About the Author
Jeff Starr = Creative thinker. Passionate about free and open Web.