Use a post from main blogs on all sub-blogs

Hi there !

I'd like to define a page on my network to display Terms of Use / Legal terms for each of my subsites. The content has to be the same on all subsites, except the sitename (and maybe other global variables of the subsite). To easy the maintenance of them I'd like to have the content stored in one single post (and not on each subsite). So ideally I'd like it to be a post/page defined on my main site, that I can show on each subsites (and that would use global variables of the subsite).

An idea how I can achieve this ?

Many thanks in advance,

Kind regards,

Alley Oop

  • Vaughan

    Hi Alley,

    Hope you're well?

    I'm not sure exactly how easy this would be with having the page only on the main site, because when users click that page, they will be taken from the subsite and be then on the main site. so having those global variables wouldn't work.

    I was thinking initially with a custom function to create global shortcodes, but as you want that page only in the main site, the shortcodes would be displaying the name of the main site & not the subsite, it would certainly work if you had the page on each subsite though.

    Let me just ask one of our developers to see if he can come up with a solution.

    Hopefully he should respond shortly.


  • Hoang Ngo

    Hi @Alley Oop,

    I hope you are well today. How many sites your network having now, including the main site.

    Also, I think the best way for doing this, is we will hook to the system when a new site has created, at that time, we will clone the TOS page on the main site. That way, this function only fire once time, and rarely, so we don't get any performance impact.

    For doing that, please add this code to your site using mu-plugins

    add_action('wpmu_new_blog', 'add_tos_to_new_blog', 10, 6);
    function add_tos_to_new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta)
        $tos_id = 33;
        $post = get_post($tos_id);
        $data = $post->to_array();

    You will need to update the $tos_id to the ID of the TOS page on your main site.

    If you have any issues please don't hesitate to let us know so we can assist

    Best regards,
    Hoang Ngo

  • Alley Oop

    Hi @Hoang Ngo !
    And thanks for you answer !

    Actually I already thought of doing that way, but creating a new post on each of my sites is exactly what I want to avoid, for a simple reason : the number of sites on the network may increase drastically, and the TOS are likely to be amended frequently. So I really would like to have the text of the TOS stored in one single post (on the main site) and not on each of my subsites.

    Thanks again for digging into this with me.


    Alley Oop

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.