[wp-hackers] Bootstrap WordPress

Ryan McCue lists at rotorised.com
Thu Apr 12 23:34:16 UTC 2012


Otto wrote:
> Include the wp-load.php file.

This does come with problems if you're loading it inside a function, as 
globals are set inside this without being explicitly declared as globals.

I find the following works:

	global $wp_the_query, $wp_query, $wp_rewrite, $wp;
	require_once(self::$wp_path . '/wp-load.php');

If you're running this on a mission critical site where you have to 
reduce queries, I also recommend setting:

	define('DISABLE_WP_CRON', true);

This ensures that you're never caught up with running cron tasks while 
trying to access anything.

-- 
Ryan McCue
<http://ryanmccue.info/>


More information about the wp-hackers mailing list