Support » Networking WordPress » Unique Post IDs for Each Site

  • I’m looking for a way to make each site on my network have slightly different post ids – something like [site_id-post_id].

    I’m running into some issues with distinguishing between posts with the same post_id but different site_ids, so if each site could generate post_ids with its unique identifier at the beginning, that would be awesome.

    Is there a way to make each site’s post_ids automatically add the site_id to the front of it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Andrea Rennick


    Customer Care at Copyblogger Media and Studiopress

    What are these issue you’re runnng into? then we can suggest a better workaround, because you can already snag it by blog ID then post id.

    They are stored as blog ID in the db. site_id refers to the entire network internally.

    Andrea, you said the posts are stored as blog ID in the db. Is there a easy way to replace that variable from the main loop to prevent all the mess below?

    I’d like to get the page with the same name, but from the main site.

    I’m very close now.

    • I’m creating empty pages in each sub-site, replicating the names from the pages in the main site, where the real content is.
    • I’ve created a conditional function listing the pages to pull the content from the main site in function.php, to return true if it’s one of them (remember, I have to make changes to fewer places, so if it’s on functions or theme will be faster than assigning a value anywhere in each site’s options)
    • based in that conditional, I have created a function to switch to the main site and pull the content from there, based on original query’s page name.
    • I’m using post snippets to define replacement variables for each site, like CityName, BranchName, etc.

    So, I’m wondering whether there’s an existing function already capable to select the site where to call the page from, using the name, instead of the id. (ID numbers across sites will be mostly different for the same-name page)

    Perfect would be something like the_mainsite_content() or other “tuned” template tags to get the content from the main site instead.

    Actually, a “clone this page to the rest of the sites” option would be more perfect, and I wouldn’t have to create empty pages in first place, switching them on and off just by excluding them from the sub-site menus (if they ever appear select-able for the menus)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Unique Post IDs for Each Site’ is closed to new replies.