Home › Forums › Front-end Issues › 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?
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!
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.