Support

Account

Home Forums Front-end Issues Same field for different pages on a multisite

Solved

Same field for different pages on a multisite

  • Hi.

    I have a multisite, where I have a field, which I use to get a photo. But when I add one photo to that field, it deletes the same field on the other pages. So if page 1: has photo
    page 2: none
    page 3: none

    and I add a photo to page three
    it should be
    page 1: has photo
    page 2: none
    page 3: has photo

    but what I get is only page three.
    So an update of a field, removes the value from the other fields. And since this is a multisite where one theme works for all the pages, I cant just make new fields and get them in the code. Unless I use a lot of if/elses.
    Does anyone have a solution or some thoughts I could use to make this work?

  • When you say you have 3 pages, what type of “Pages” are they? Are they “Pages” as in WP pages (page posts) with an editor? Options pages? Something else?

  • They are sites, bad phrasing on my part there

  • So now I’m completely confused? You have 3 sites in a multisite installation of WP. You have a page on each of these sites? Is this an options page? or a Page? When you edit the image on one site it updates the image on all three sites? Can you give me details on the setup?

  • On my multisite network, I have 3 sites. Each of those use the same theme. On one page of each site I show some news, and on each article, the author gets named, and his picture gets showed. So when I add his picture on site 1, it gets removed on site 3. I need to keep it there, and not have it removed when I add him to another site

    http://jessheimhage.soloneiendom.no/visningsboliger-endelig-klar/
    http://kolbotnhage.soloneiendom.no/byggestart-rundt-hjornet/

    Both should have that little circle image

  • So, I think I may understand what’s happening, maybe. Is the image associated with the user’s profile page? Or is this image added to some other page?

    If it’s on the user profile page then it is save in the wp_usermeta table. Unlike the other tables in WP on a multisite where each site has it’s own table, on multisite all the sites still share the same _usermeta table. When you upload an image on site 2, that image is stored in the wp_2_posts table and associated with site 2. When you go to site 3, that image is not found in the wp_3_posts table, so the user does not have an image there. If you now upload an image on site 3, the image ID in the single _usermeta table is updated to point to the new image in the wp_3_posts table. This image ID does not exist in the wp_2_posts table so the image is not found there any more.

    On a multisite installation, custom fields that have any type of a relationship to other tables are going to give you this problem. You will either need unique names for these fields on every site or you will need to only update the values on the main site and then switch to the main blog before getting these values with https://codex.wordpress.org/Function_Reference/switch_to_blog

  • This is what I ended up doing after all. This was a major problem in the backlog, with such an easy fix. Thank you!

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Same field for different pages on a multisite’ is closed to new replies.