The MU forums have moved to WordPress.org

The best way to copy pages to every blog in wpmu site? (5 posts)

  1. konus
    Member
    Posted 15 years ago #

    I have a main site who has a "pool" of articles/pages that need to be replicated to every single site in the network.

    Wich is the best way to make a copy of one (or more) pages to the others sites??

    I'm thinking in modify the upgrade.php and add the lines like:

    $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt,....

    But I'm not sure about it, because there are severals articles too...

    Is this the way to add common categories too??

  2. MrBrian
    Member
    Posted 15 years ago #

    Yup. I've found the best way to make changes to every blog was by modifying the upgrade script.

  3. doughthedj
    Member
    Posted 15 years ago #

    Can either of you guys provide further information on this? I would like to add some pages to all the blogs on my site but am clueless as to what to add to the upgrade.php file.

  4. konus
    Member
    Posted 15 years ago #

    You can get easy some code from upgrade.php to do what you want. The main trick will use:


    $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, post_status, post_type,.....

    the important thing is use post_type='page'

  5. dains
    Member
    Posted 15 years ago #

    Wouldn't RSS work too? I'm looking to copy just a set of pages (parent and all children/subchildren) to other sites, instead of the whole site. Although I suppose I can set up a site with just those pages.

    Oops, I forgot - why not export and import the content? You need to set all of the content to export to one author name, and as long as you don't have any categories in the new site the same as the old site, your new posts come in ok, even making the categories. If you do have duplicates, WP tries to put the content in the same categories, which can mess up your structure.

    I'll give it a shot with just pages and see what happens.

About this Topic