Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use the WordPress IXR Client to query a remote XMLRPC method.
<?php
function my_init_test()
{
//check for ?test=1 or do nothing
if(empty($_REQUEST['test']))
return;
//user id to test
$remote_user_id = 1;
//load IXR class
require_once ABSPATH . 'wp-includes/class-IXR.php';
//connect
$rpc = new IXR_CLIENT('http://otherwordpresssite.com/xmlrpc.php');
//query
$rpc->query('pmpro.getMembershipLevelForUser', 'adminusername', 'adminpassword', $remote_user_id);
$r = $rpc->getResponse();
//show output and die
wp_die('<pre>' . var_export($r, true) . '</pre>');
}
add_action('init', 'my_init_test');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.