0

I have a requirement to add certain posts (marked with a tag or category) from "site a" to another site ("site b"). I think the best way would be for site b to periodically check site a for the presence of new posts in the category or with the keyword, but perhaps it would be better for site a to push select new posts to site b at time of publication.

The posts should look like they are locally stored posts, with featured images and full text search ability -- an RSS-feed-like list of the most recent posts isn't acceptable.

Thanks

1 Answer 1

0

You could add a filter to the post publish process in site A. The filter would check for the tag/category, and if found, run a process to create a post in Site B.

See https://codex.wordpress.org/Plugin_API/Action_Reference/save_post . Something like:

add_action( 'save_post', 'my_site_b_create_post' );

function my_site_b_create_post($post_id) {
   // check for category
   // if category, then save content of site A post into variable (maybe title, author, etc)
   // create post on site B
   return;
}

Adding that hunk of code to the functions.php of Site A (in a Child Theme, of course, so a theme update doesn't bork your code).

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.