If you need to load the WordPress database outside of WordPress (for cron jobs, specialty pages, etc) simply put this at the beginning of your script:
define( 'SHORTINIT', true );
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
This will tell WordPress to load up with as little as necessary. If you don’t have the SHORTINIT
call then it will load all of WordPress as normal (which you probably don’t want).