Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utility to load WP core #19

Open
tamagokun opened this issue Oct 14, 2013 · 1 comment
Open

utility to load WP core #19

tamagokun opened this issue Oct 14, 2013 · 1 comment

Comments

@tamagokun
Copy link
Owner

Pomander is a great place to write util scripts for interacting with Wordpress. It might even be a good idea to utilize some WP core functions in this plugin itself.

In doing so, we need a way to boot up the Wordpress core, something like this should work:

        define('BASE_PATH', dirname(__DIR__)."/wordpress/");
        define('WP_USE_THEMES', false);
        $_SERVER = array(
            "HTTP_HOST" => "http://localhost",
            "SERVER_NAME" => "http://localhost",
            "REQUEST_URI" => "/",
            "REQUEST_METHOD" => "GET",
            "SCRIPT_NAME" => "index.php",
            "PHP_SELF" => BASE_PATH
        );
        global $wp, $wp_query, $wp_the_query, $wp_rewrite, $wp_did_header;
        require(BASE_PATH . 'wp-load.php');
@tamagokun
Copy link
Owner Author

Things like HTTP_HOST SERVER_NAME and BASE_PATH will need to be dynamic based on the Environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant