[wp-hackers] Bootstrapping WordPress
Dagan.Henderson at epyllion.com
Tue Oct 4 16:24:01 UTC 2011
Of course, this now raises the question of handling a multisite install. Is there a way to bootstrap WordPress and then specify the blog to execute against?
From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Brian Layman
Sent: Tuesday, October 04, 2011 8:49 AM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Bootstrapping WordPress
On 10/4/2011 11:37 AM, Tom Barrett wrote:
> On 4 October 2011 16:19, Dagan Henderson<Dagan.Henderson at epyllion.com>wrote:
>> I'm working on a process that requires a cron job and would prefer to
>> execute the PHP script directly instead of using cURL to execute the
>> code via the Web server.
> I was shown this method (assuming PHP script is in the docroot):
> // Require the standard WordPress header
If you don't plan on doing something that visually themed like your site, you can just include wp-load.php.
I put a sample script for doing this sort of thing up on GitHub.
It demonstrates a bunch of techniques. It takes parameters from CLI or your browser. It loads the WP environment and access the WP API directly as well as demonstrates how to curl into the wp-admin area of a site to automate things.
Maybe you'll find it helpful.
wp-hackers mailing list
wp-hackers at lists.automattic.com
More information about the wp-hackers