Sync posts from one WordPress site to another

Have you tried codex.wordpress.org/XML-RPC_Support.

This code works, in conjunction with the IXR library found at incutio:

include('IXR_Library.php');

$usr="theusername";
$pwd = 'thepassword';
$xmlrpc="http://not-therealurl.com/xmlrpc.php";
$client = new IXR_Client($xmlrpc);

$client -> debug = true; //optional but useful

$params = array(
    'post_type' => 'post',
    'post_status' => 'draft',
    'post_title' => 'Test Post',
    'post_author' => 4,
    'post_excerpt' => 'This is my test excerpt',
    'post_content' => 'This is my test post. Now its longer than the excerpt.'
);

$res = $client -> query('wp.newPost',1, $usr, $pwd, $params); 

Leave a Comment