Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Scenario: I have a mother site example.com which has a blog and say about 12 category. I also have 12 other wordpress site. Some in the subdomain of example.com and some are different domains. 12 Sites represent 12 category. When I Post on a category the post should be also posted to a appropriate category site.

When I think about it I can do it via RSS and XML-RPC. But which one is the best choice for this purpose? I have to place code in the mother site for xml-rpc and child sites for RSS (using simplepie)

Here is some more Point that I have to focus:

  1. If i edit, delete posts on parent site the child site should be modified.
  2. If I use xml-rpc What is the right way to save the username and password for child sites? Does xml-rpc on wordpress supports sending hashed password?
  3. Using RSS is it possible to update or delete post according to mother site?

Please share your experience to help me choose the better solution. Thanks!

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

It really depends on where you want your focus to be. Here's a case for and against each:

XML-RPC

It sounds like your standard process is:

  • Log in to main site
  • Write post in X category
  • Publish post
  • Post is copied to the child site specific to X category

In this setup, XML-RPC makes the most sense. You write a post on one site, and that site should then be responsible for pushing the content out to the category site. So XML-RPC would be enabled on your child sites but not necessarily on the main site.

You could set this up with a single plugin on the main site that ties in to the post publication hooks and inserts posts on the child sites.

Also, you can push updates to the child sites from the main site. Let's say you publish your post and it gets pushed out. Then 10 minutes later you notice a glaring typo in the title. You can edit the original post on the main site and automatically push the update to the child sites still using XML-RPC.

I'm not trying to make this sound easy (it won't be), but it will be possible.

RSS

RSS turns the process around:

  • Log in to main site
  • Write post in X category
  • Publish post
  • The child site specific to X category polls the main site's RSS feed on a regular interval and updates itself accordingly

The child site is basically just calling home every now and then to see if it needs to be updated. RSS makes sense because it's lightweight. Also, by keeping XML-RPC turned off, you're not opening any additional access points to your site.

You can also pull in updates of content from the child site. When you pull in the RSS feed, you can check to see if anything's changed and update content accordingly.

Again, not trying to make it sound easy ... but possible.

Which one would I recommend?

Having worked extensively with XML-RPC (I've written some of the interface and consult on it frequently), I'm tempted to suggest that route.

WordPress' XML-RPC system already includes all of the code necessary to authenticate requests, insert posts, upload media, update posts, etc. Everything you need to create a post on the child site already exists. The bulk of what you'd need to write is the plugin on the main site that pushes content out.

share|improve this answer
    
Really refreshing comment. Thanks! I think i am going to try xml-rpc first. I don't have enough knowledge about it yet but i can start learning. But that means I will need to store child site password on it right? Should i hash those passoword or store plain text? –  Sisir Oct 25 '11 at 19:29
    
It means you'll need to store a user for the child site in the main site. But when you make requests, the passwords will need to be sent as plaintext. So I'd recommend creating a new user just for the XML-RPC interaction and storing that password (as plaintext) for the main site. If the user is ever compromised, it's easy to turn off. –  EAMann Oct 25 '11 at 20:44
    
Author Level user should be okey for that right? Another thing has been bugging my head. Is it possible to do something like this: Doing the first post insertion via RSS then after the post get change the parent site will ping the child site somehow about the post id that have been changed? –  Sisir Oct 26 '11 at 6:43
    
Author level user should be fine. Regarding your other question about RSS ... you should open a new question for that one. –  EAMann Oct 26 '11 at 13:26
    
Thanks! I will work further on it and let you know if i have any more questions. –  Sisir Oct 26 '11 at 14:30
add comment

My philosophy is to keep the XML-RPC turned off unless absolutely necessary.

I'm not sure I understand why you would want twelve different installations when you can use one multisite installation with all twelve sites on the same database.

This would make it easier to surface content from the master site on the different sub-sites (via category context) without duplicating db entries and maintaining 12 different databases. There would be no need user/pass storage.

You could create one parent theme that would be used on all sites. Then you can create a child theme for each sub site that only sets a constant defining the category slug to pull content from the master site.

For your concoction of sub and top-level domains you can use this plugin: premium.wpmudev.org/project/domain-mapping/

share|improve this answer
    
you are right those sites may be hosted in multisite as well as different installation. I would like to make it flexible to client if they have any already exist sites then they just add it via theme option and make it work. But it can be a special case and something i can add in theme option in case. Can you refer me to any codex page about category context? Thanks! –  Sisir Oct 25 '11 at 9:32
    
Can you explain your philosophy to keep the interface turned off? –  EAMann Oct 25 '11 at 16:31
    
I prefer to keep XML-RPC disabled unless absolutely necessary because it gives a hacker one more opportunity to hack my site. I'm not a big fan of storing plaintext passwords as would be needed in this use case. I am not against XML-RPC. I've used it many times and it works great. It's my personal opinion that it should be used for mobile apps, browser extensions, etc... and not complicate what WordPress already does so elegantly out-of-the-box with a Multisite install. That said, the beauty of WordPress is the flexibility and scalability it provides for any user preference. :) –  Brian Fegter Oct 26 '11 at 3:11
    
I agree with the storing of plaintext passwords ... but there are situations that warrant it. Also, just to clear things up ... XML-RPC makes your site no more vulnerable to hackers than WP already is. The methods are still protected by WP's authentication system. –  EAMann Oct 26 '11 at 3:40
    
Thanks for the followup. I have used XML-RPC on the surface only. I've never delved into core on this...so I guess you're the horse's mouth on this subject as you've worked on core. :) –  Brian Fegter Oct 26 '11 at 4:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.