Skip to Content
Building Web Apps with WordPress
book

Building Web Apps with WordPress

by Brian Messenlehner, Jason Coleman
April 2014
Intermediate to advanced
462 pages
10h 48m
English
O'Reilly Media, Inc.
Content preview from Building Web Apps with WordPress

Chapter 10. XML-RPC

WordPress is awesome, and you can build a lot of really cool applications just with it, but what if your application needs to communicate with other applications or other WordPress installations?

XML-RPC is a remote procedure call (RPC) protocol that uses XML to encode its calls and HTTP as a transport mechanism. WordPress uses an XML-RPC interface to easily allow developers to access and post data from other applications, including other WordPress sites.

We’ve compiled a list of some of the available methods of the wp_xmlrpc_server class along with the arguments that can be used and what values each function returns.

If you would like to follow along with the code examples for some of the following methods, set up the following function in a custom plugin or in your theme’s functions.php file. Also, be careful because some of the examples update and delete data:

<?php
add_action( 'init', 'wds_include_IXR' );
function wds_include_IXR() {
    // You need to include this file in order to use the IXR class.
    require_once ABSPATH . 'wp-includes/class-IXR.php';
    global $xmlrpc_url, $xmlrpc_user, $xmlrpc_pass;
    // Another WordPress site you want to push and pull data from
    $xmlrpc_url = 'http://anotherwordpresssite.com/xmlrpc.php';
    $xmlrpc_user = 'admin'; // Hope you're not using "admin" ;)
    $xmlrpc_pass = 'password'; // Really hope you're not using "password" ;)
}
?>

wp.getUsersBlogs

Calls the function wp_getUsersBlogs( $args ) and requires an array:

  • $username—A string of the username ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Wordpress Web Application Development - Third Edition

Wordpress Web Application Development - Third Edition

Rakhitha Nimesh Ratnayake

Publisher Resources

ISBN: 9781449364779Errata