Ok I resolved the issue with saving values by disabling Yith Tab Manager
The last issue I have is with bidirectional relationship is between two different post types (product and featured_item) using two different field names (related_products and related_projects)
I was able to create bidirectional fields when I used a single field related_posts which I placed in both the Product and Project edit pages, but I’ll need to use a different field name for each post type
Is it possible to create bidirectional fields using two different field names?
Ok I just figured out what this was all about, YITH Tab Manager seems to have caused the conflict
I disabled it and everything works perfectly smooth with the Post-2-Post plugins, but I have to keep the Tab Manager running on site
Is there any way I can troubleshoot what’s causing the conflict with YITH Tab Manager?
I just tried switching to the twenty seventeen theme while disabling all plugins keeping only ACF active but the issue persists
Could you post a screenshot with the settings of the field you’ve tested? I think my conflict is with duplicate field names or incorrect setup/filters/locations
I just noticed values do update in ‘featured_item’ posts but not in ‘product’ posts
I’m still unable to update/remove relationship values in a ‘product’ post
Here’s what I just tried
1. disabled all plugins except ACF
2. changed theme to Twenty Seventeen
3. create new product
4. create new project
5. create new relationship field ‘test_field’ showing on product and project post types
6. linked new product to new project and published, relationship value is saved (on product edit page)
7. deselected the value and published; value not saved
I don’t think it’s a bug in the plugin but I tried everything, what else could it be?
Ok then I got it working that way, just unsure why I’m unable to update/remove relationships once published, I’ll start a new thread on the issue
Ok, what would be the appropriate method?
Ok I was able to remove those values from the database, that cleared up the relationships; though still unable to remove/update selections from the edit page
I think I’ll try something different, what would be the setup if I want to seperate the post types so that in Product page it will let you select only Portfolio posts and vice versa (Portfolio page lets you select only Product posts)
Do I create two field groups, Related Products and Related Projects, then create a relationship field ‘related_posts’ in both groups? Or is it going to cause a conflict?
Yes that’s what I possibly did, I created duplicate fields, then deleted them, created new fields with the same names etc, I think that’s what caused the conflict
How can I clear this old data from the databse or where are they located in the database?
Just to note, when the relationship field is empty it also reflects on front end
e.g in product2 I haven’t addded relationships yet so the page renders “no related posts” message
(just as expected)
The thing is it won’t can’t clear/update the relationship field once there are existing relationships as if something prevents it
Yes I think because I’m unable to remove posts from the relationship field itself, I think it is more of a conflict in the database
How do I clear the database from everything related to these relationships?
The field names I used/switched between, since the first solution I attempted were related_products, related_projects, related_posts, relatedposts
Ok, that worked! I seem to be able to add relationships, but I can’t remove them, e.g. I select project 1 and project2 in the product1 relationship field, and save it; it displays on front end as expected, but when I remove project1 and project 2 from the selection and then update the post (product1), they just stay there; what could possibly cause this?
I’d like to give it a try with the plugin (post-2-post), just unsure what the setup would be and how I would pull the values
Here is my current setup:
The two post types are Product (‘product’) and Portfolio (‘featured_item’)
What would I need to change in my original code to pull the related post IDs using the plugin?
I noticed I’m unable to remove/deselect posts from the relationship
e.g. I select 2 related posts, then update the post being edited, and the post shows in the two other posts
I then deselect the 2 related posts and update, and they won’t be removed from the relationship
How do I go around it?
The second one worked great for me, thanks a lot!
Works like a charm, thanks so much!
Here’s the solution if it helps anyone:
$img = get_field('banner_image', 'category_' . get_queried_object()->term_id);
if ($img) {
echo $img;
}
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.