[wp-hackers] Cloning content from Master site into new sites on a WP Network

Mike Little wordpress at zed1.com
Thu Jul 12 13:44:42 UTC 2012


On 12 July 2012 14:29, Jesse Friedman <highfive at jesserfriedman.com> wrote:

> Thanks Mike
>
> I can query the database to make they are only getting what they wanted and
> I can bring over taxonomy and meta data as well.  My question now is, is
> writing a mysql query like this bad form?  It's just so much faster and
> more efficient.
>
>
I would suggest using the $wpdb object and running your query through the
class' prepare() function, especially if it might contain user input.
Why use replace into? If this only happend once on a new site, you
shouldn't have any existing records to match.
Also bear in mind that your SQL is copying over post ID's (and will copy
over meta and term ID's too), so the post numbering will likely look a
little weird.


Mike
-- 
Mike Little
http://zed1.com/


More information about the wp-hackers mailing list