Multisite with a single, shared custom post type, while retaining site URL

Small multisite setup, two very different sites, both need to access an event custom post type. I don’t want to duplicate posts (there are some plugins that “broadcast” a post to the network).

switch_to_blog(1) will get me part way there, where blog 1 is the “master” blog that contains the event data, as far as archive-style pages that list all the events. But my concern is that the URL/permalink of the event, when viewed from blog 2 will point to blog 1, and following that permalink will then take the user to the other blog, confusing the user.

Is there a solution (possibly using rewrite) that would allow an event post at //blog1/events/event1 to appear as //blog2/events/event1 when viewed from blog 2?

2 Answers
2

There are two options:

  1. Register the CPT on blog 2 with 'show_ui' => FALSE. Hook on blog 1 into save_post and copy the data to blog 2.

    • Pro: You can search in those posts. Correct templates will be used automatically.
    • Con: Duplicated data are always a little bit … dirty.
  2. Register an endpoint with an URL scheme like the CPT on blog 1 (EP_ROOT).

    • Pro: No duplicated data.
    • Con: You have to implement the template logic manually to load the correct theme file. And search will not work.

Leave a Comment