Question

I need to activate theme for wordpress blogs which are present remotely. I thought I will do it with xmlrpc api of worpress http://core.svn.wordpress.org/trunk/wp-includes/class-wp-xmlrpc-server.php, but wordpress does not provide any api method to activate or switch theme.

Similarly, I also need to activate plugins for the wordpress blogs remotely.

I searched a lot about it and got following solution: https://wordpress.stackexchange.com/questions/15534/is-it-possible-to-change-a-blogs-theme-through-xml-rpc-command-and-if-so-how

But this solution doesn't seem feasible to me, as it asks for changes in the code. This is feasible until I am activating my theme locally, but in my case I can have any number of blogs present remotely. So I ruled out this.

Does anyone came across this kind of situation, if yes, how did you manage to tackle the situation ?

Was it helpful?

Solution

You will need to implement your own XMLRPC methods to perform the theme switch, most likely through a plugin.

An example of a plugin that extends the Wordpress XMLRPC API is WP-Multisite-XML-RPC. I'd suggest reading it, and adding your own methods to change themes. I can't give away the code I wrote to do it on our system, but it's fairly straight forward.

Additionally, there is another Wordpress Plugin, Extended-XML-RPC-API that is supposed to let you call almost any built-in Wordpress function via xmlrpc. I'd suggest giving it a look too.

So, basically, you cannot do it with the built in API, but it's fairly easy to extend the API to do what you want, as long as you can install plugins on your server.

OTHER TIPS

I don't know if you already found a solution to your problem, but I have just written a plugin that allows retrieving a list of themes and switching themes using XML-RPC. I've placed the code on Github and have put together some instructions on my blog.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top