Today I’m going to show how to remotely publish post using xml-rpc of the wordpress.This is actually very simple and powerful.If you want to publish posts or pages without log into the wordpress admin panel you can use this method.First we’ll consider what is this XML-RPC and it’s usages.
What is this XML-RPC?
XML-RPC is a protocol for remote process calls which makes use of XML for the data exchange and it principally makes use of HTTP for the actual call.
In XML-RPC the client that wishes to make a call to a remote technique the input parameters in the form of XML and sends it through an HTTP request to a remote server implementing the XML-RPC protocol.
The distant/remote server implementing the XML-RPC protocol will get the request after which performs the remote technique and returns the end result again in XML format.
You can find more information from XML-RPC WordPress API
Advantages and Usages of XML-RPC
WordPress XML-RPC server supports multiple types on APIs for XML-RPC. Following are the types of APIs that WordPress XML-RPC server supports:
- WordPress API
- Blogger API
- MetaWeblog API
- MovableType API
- PingBack API
- Get post or posts details
- Add new post or multiple posts
- Edit posts
- Delete posts
- Get posts types
- Get post formats
- Get post status list
Disadvantages of XML-RPC
Hackers can attack to your site using this class-wp-xmlrpc-server.php file to access the web site.So you must add security settings to prevent that.Mostly,
- Hijacks your website without your knowledge
- Uses your site for a DDoS attack
- Potentially gets your domain labelled as a spammer
How to stop that?
You can Add a filter to functions.php,prevent access to XMLRPC.php using .htaccess,use a plugin for this.We’ll talk about this in next post.
Enough.Let’s see how to remotely publish post using XML-RPC.
First of all you must enable the XML-RPC in WordPress.
Enable XML-RPC in WordPress 3.4 and below
Due to the security reasons in WordPress versions 3.4 and below, XML-RPC has been disabled by default.
To enable XML–RPC:
1-Log into your WordPress Admin panel.
2-On the sidebar, select Settings and then Writing
3-Check the box next to XML-RPC
4-Save your settings