• I need to automate the process of exporting all posts from one WordPress blog and importing them into another WordPress blog. I’m using the following PHP code to export and it’s working fine:

    require_once( ABSPATH . 'wp-admin/includes/export.php' );
    
      ob_start();
    
      $args = array(
        'content'    => 'post',
        'author'     => false,
        'category'   => false,
        'start_date' => false,
        'end_date'   => false,
        'status'     => false,
        );
      export_wp($args);
    
      $xml = ob_get_clean();
    
      file_put_contents('C:\\path\\to\\save\\exported\\posts.xml', $xml);

    I cannot figure out the PHP to import this into a different blog. Can someone please point me in the right direction? Thanks! The two blogs are on the same server (either Windows 7 or Windows Server 2008 R2) and I have access to the MySQL DBs for both blogs.

  • The topic ‘Automate WordPress importer’ is closed to new replies.