[wp-hackers] Bootstrapping WordPress
Dagan Henderson
Dagan.Henderson at epyllion.com
Tue Oct 4 16:52:37 UTC 2011
Okay, so I can use the prefix_blogs table to get a list of blogs in a multisite install and then use switch_to_blog() to iterate through them, but is there a WP function that returns a list of active blog IDs? Checking the functions list and trac I see a lot of potential options, but it's unclear what the sanctioned method is.
-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of William P. Davis
Sent: Tuesday, October 04, 2011 9:25 AM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Bootstrapping WordPress
You can also just use wp-load.php. That will load up everything, although there's a variable (that I forget) that allows you to turn off plugins.
Sent from my BlackBerry(r) wireless device
-----Original Message-----
From: Dagan Henderson <Dagan.Henderson at epyllion.com>
Sender: wp-hackers-bounces at lists.automattic.com
Date: Tue, 4 Oct 2011 09:22:35
To: wp-hackers at lists.automattic.com<wp-hackers at lists.automattic.com>
Reply-To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Bootstrapping WordPress
Thanks, Brian!
-----Original Message-----
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
> require(dirname(__FILE__).'/wp-blog-header.php');
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.
Here:
https://github.com/brianlayman/WordPress-Manipulator/blob/master/wpmanip.php
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.
--
Brian Layman
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list