How to load wordpress environment without loading the template?

If you place the file in the WP root directory, e.g. http://mysite.com/myscript.php

require( dirname(__FILE__) . '../blog/wp-load.php' );
if (function_exists('wp_create_user')) {
    echo "wp_create_user() found";
}

If you are in a different directory, just make sure you are loading wp-load.php from the proper location.

Leave a Comment