There will be one 'main' Wordpress site using the plugin that will need to be able to communicate with 'children' sites that use the plugin.

The main website will have the domains of the 'children' stored in its database as well as some basic token that will be stored individually in each child site and all of the children's tokens will be stored in the main site's database.

I need to create a PHP file that will be responsible for communication between those sites.

Once that is done, the 'main' site will need to send every new post to all the child sites. Then the child sites will receive that post, keep it idle for a bit, modify it and then post it.

How do I make such communication? Any ideas are welcome because I currently have no idea how to approach it!


1 Answer 1


You should keep some variable / configuration value where the plugin should know if it's the main site or not.

Your plugin should put a hook over the post publishing action, and then, communicate with each of the sites of the list.

Your easy approach is to send that key as a parameter, then check if it's correct on the endpoint, but I will recommend you to use some better and more sophisticated approach.

As the number of dummy sites could increase, I think you should implement also a way to communicate the existence of a new site on the net, so you can paste a shared key on some of your plugin fields to validate that new site on the main site, and the main site will 'subscribe' this new client. That key could be different than the per-site key.

The way you can communicate between sites is not difficult, http is a great protocol for communication between parts, you can use CURL ( or Guzzle ) to send POST requests between your main site to your end sites. Finally you should have some endpoint in each site to receive these calls and perform the action with the received post ( over POST call, not GET, as the contents of the original post could be bigger than GET requests can carry ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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