Execute External WordPress Functions
Posted on August 27, 2006 in Function, WordPress by Jeff Starr
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"); ?>
This may be generalized by writing:
<?php require($_SERVER['DOCUMENT_ROOT'].'/blog/wp-blog-header.php'); ?>
Related articles
- Working with Multiple Themes Outside of the WordPress Installation Directory
- htaccess Combo Pack: WordPress Permalinks and non-www Redirect
- Open External Links as Blank Targets via Unobtrusive JavaScript
- Dynamic Link Insertion via Unobtrusive External JavaScript
- Eliminate 404 Errors for PHP Functions
- Embed External Content via iframe and div
- Industrial Strength WordPress Dofollow Upgrade
No Responses