Hello, I just saw today that ACF 6.2 release now offers Bi-Directional Relationships natively.
This is what I read on their Changelog page:
New – Bidirectional Relationships now supported for Relationship, Post Object, User and Taxonomy fields. View the?release post?for more information
Is there any negative impact to switching to the built in way of handling this via ACF Pro features vs. using ACF Post-2-Post plugin? I just want to make sure I don’t go screwing up anything.
Thanks!
Hi John,
We are currently trying to use the plugin ‘ACF Post 2 Post’ but don’t seem to get it fully operational. Most of the times, relations are made correctly, but in some cases (which I’m unable to explain because they seems to be the same as others that do work), the relation is simply not made.
Our setup is that we have Polylang installed, and we’re trying to setup a bidirectional relation between WooCommerce Products and a post type called ‘Constructions’.
We’ve set it up like this:
I assume this is correct. Using the same field name is mandatory I believe, right? The chosen name is a test-name (of course).
Is the plugin is also designed to be used between 2 different Post Types? I believe it is, right?
I don’t have a lot of info for you to go on so I’m wondering if there are any known issues or things to take into account when using the plugin?
For example, could it be related to Polylang? Are there any known issues there?
We might be able to pin point the issue with any info that you provide.
Thank you!
Erik
Plugins in regards to ACF:
ACF QuickEdit Fields Version 3.2.3 by J?rn Lund
Advanced Custom Fields: Gravity Forms Field Version 1.1.0 by @adam_pope
Advanced Custom Fields PRO Version 6.0.7 by WP Engine
I’m have a lot of trouble figuring out how to set up the custom fields. I’m just not understanding how it works. Can you please share a basic video example? I’m at my wits end with this, it’s just not working the way I need it to.
Can you tell me what the names of the custom fields should be???? The way I’m naming them and grouping isn’t working.
Can you group fields into field groups? Or does each relationship field need to be separate?
Here is my fields and how it needs to be organized:
ON HOME LISTING POST ? ADMINS CAN SELECT A RELATED COMMUNITY?Home Listing Post – Select Related Community
ON HOME LISTING POST ? ADMINS CAN SELECT A RELATED SALES MANAGER?Home Listing Post ? Select Related Sales Manager
ON HOME LISTING POST ? ADMINS CAN SELECT A RELATED MODEL HOME?Home Listing Post – Select Related Model Home
ON COMMUNITY POST ? ADMINS CAN SELECT A RELATED HOME LISTING?Community Post – Select Related Home Listing
ON COMMUNITY POST ? ADMINS CAN SELECT A RELATED SALES MANAGER?Community Post – Select Related Sales Manager
ON SALES MANAGER POST ? ADMINS CAN SELECT A RELATED COMMUNITY?Sales Manager Post – Select Related Community
ON SALES MANAGER POST ? ADMINS CAN SELECT A RELATED HOME LISTING?Sales Manager Post – Select Related Home Listing
ON MODEL HOMES POST ? ADMINS CAN SELECT A RELATED HOME LISTING?Model Homes Post – Select Related Home Listing
]]>Hello, I created a Relational Post Object Filter so that I could show more information about a post in the selection via the admin. The post object is shared due to the custom field names for the relationship fields being the exact same. This is presenting me with a problem where it’s showing empty post object information on the other side of the relationship.
For example:
Home Listings – Shows a relationship post object field to select a community to associate the home listing.
Communities – Shows a relationship post object field to select a home listing to associate with the community.
On the Communities post in the admin, the post object selection is showing unwanted filtered data.
How do I exclude the unwanted data from the filter on the the communities posts in the admin when they both share the same custom field relationship name in ACF Pro settings?
Here’s my code for the filter that works great on one-side of the relationship but I’m not sure how to get this to work so the Community select doesn’t show Home Listing Filtered info:
add_filter('acf/fields/relationship/result/name=show_as_community_model', function($title, $post, $field, $post_id) {
$lot = get_field('lot', $post->ID);
$sqft = get_field('sq_ft', $post->ID);
$mls = get_field('mls', $post->ID);
$price = get_field('price',$post->ID);
$title .= ' ? Lot: ' . $lot . ' ? SqFt: ' . $sqft . ' ? MLS: ' . $mls . ' ? Price: ' . $price . '';
return $title;
}, 10, 4);
`
]]>Hi, does this plugin work with the user field as well? Since it operates very similarly to post object and relationship.
]]>Hello,
First I have to say: what a nice little plugin! All seems to be working excellent except one situation, here it is:
I have a 1:N relationship between 2 CPTs, Courses and Terms.
Lets have a simple situation:
Action:
I open the Course B and select Term 1, then save.
What I would expect:
OR
OR (best solution)
What really happens:
When I changed the behaviour to overwrite the settings it all worked as expected:
Here is the filter I used:
add_filter('acf-post2post/overwrite-settings', 'bleye_acf_post2post_overwrite');
function bleye_acf_post2post_overwrite($settings) {
$settings['termin_kurz'] = array(
'overwrite' => true,
);
return $settings;
}
So, is this an intended behaviour? It doesn’t seem to me. For now, I will get by by overwriting the settings, but I would prefer, it wasn’t be possible to select the posts which are already in use (when overwriting is disabled).
Could you please look into it and give me some feddback?
Thank you very much
Petr
Hi,
On the first hand, thank you for your useful plugin !
Here’s my scenario :
– I have a CPT A and a CPT B.
– I have a bi-directional Relationship field with ACF between these both CPT .
– The CPT A is with the published status.
– The CPT B is regularly with the draft status.
When I publish the CPT B via Quick Edit (because I have to pusblish multiple post on the same time), the bi-directional is not working.
The relationship is OK with the way “CPT B/POST > CPT A/POST” but not “CPT A > CPT B”.
When I directly publish individualy through the edit page of the CPT B, the bi-directional is working.
Do you know why ? Hook cause ? and do you have any solution ?
Thank you so much,
FX
Hi,
I have a problem, see the situation:
I have Post Type called Products and CPT called Components.
In Products, I created: Post 01 and Post 02
In Components, I created: Component 01
Inside Post 01 and 02 there is a relationship field where I made the relationship with component 01. On the frontend, both post 01 and post 02 make the relationship correctly.
But in CPT Component 01, it only relates to Post 01 and Post 02 does not appear.
Can you help me please?
]]>Hi all!
I have created a relationship (single one) to relate my article. I have 2 post_type in my db created using Custom Post Type UI for order my post. I’m using ACF PRO v5.10. I have downloaded, installed and activated this plugin and created some relationships but it is not working bi-directionally. Any idea of what am I doing wrong? I have only one relationship field name and I’m using it on every page to get a relationship. I have read all the previous questions but no way. I need to set up something like my relationship field name or similar? I need to recreate my relationship after the plugin installation?
Many many thanks for every help or advice!
]]>Hi,
Thank you for the wonderful plugin.
Is it possible to use its functionality somehow to add a reciprocal relationship between posts of the same type?
Such as, ‘parent-child’, ‘boss-employee-, ‘sequel-prequel’?
Since the plugin requires the field name to be the same on both sides I would assume that it isn’t possible, but if theres’s a way to achieve this I’d really appreciate your help.
Thanks and regards
Amos
Hi,
Thank you for your plugin.
I’m one of the Global Project Editors for the french locale and I would like to translate your plugin in french, but it’s impossible on www.ads-software.com.
Look at https://wp-info.org/tools/checkplugini18n.php?slug=post-2-post-for-acf, it seems it’s just the textdomain who is wrong.
Could you please fix it?
Thank you in advance.
Best regards,
Bruno
Hello,
I’m finding that when I add a post that contains a bidirectional relation, your plugin does properly add the post to the other relationship cpt field. But when I delete a post (within the WP dashboard), that post is not removed from the other relationship. In my case I’m using Toolbox and the Timber Posts module still shows posts from the relationship field, which are actually deleted.
If I go into the WP dashboard and edit the particular record containing the other relationship and just click Update, the post no longer shows in the Timber Posts. It seems during the update process the relationship field is updated with only published posts.
So it seems as if this statement in your documentation: “If a post is removed from a relationship then the post being removed will also be updated to remove the relationship to the post being edited.” is not working for some reason.
Using ACF 5.8.9 and 1.5.2 of your plugin if that makes any difference.
Thanks for any assistance!
]]>I use your plugin to show related posts of the same post type, using a Relation field. It’s not working on my end at all, so I was wondering how to troubleshoot this. I used this before on another site when connecting posts from different post types and that did work. Thanks in advance.
]]>I am getting the following error when saving a post that has a relationship attached to it… The error only happens once, then after I click update on the post, it seems to be fine the second time.
Any help or ideas on this?
]]>Notice: Trying to access array offset on value of type bool in /home/…/wp-content/plugins/post-2-post-for-acf/acf-post2post.php on line 99
Notice: Trying to access array offset on value of type bool in /home/…/wp-content/plugins/post-2-post-for-acf/acf-post2post.php on line 130
Warning: Cannot modify header information – headers already sent by (output started at /home/…/wp-content/plugins/post-2-post-for-acf/acf-post2post.php:99) in /home/…/wp-admin/post.php on line 231
Warning: Cannot modify header information – headers already sent by (output started at /home/…/wp-content/plugins/post-2-post-for-acf/acf-post2post.php:99) in /home/…/wp-includes/pluggable.php on line 1296
Warning: Cannot modify header information – headers already sent by (output started at /home/…/wp-content/plugins/post-2-post-for-acf/acf-post2post.php:99) in /home/…/wp-includes/pluggable.php on line 1299
I have two custom post types one is Sessions and the other is Presentations. I have an ACF relationship field named relationship on both post types but they are different. On the sessions field it’s getting the names of the presentations post type and on the presentations field it’s getting the names of the session post type.
I was assuming when I added the session to the presentation post it would show the presentation selected in the session, is this not how it works?
Was there anything other than that I needed to do? i.e. any other coding needed to get this to work this way?
]]>Does your plugin provide multiple to one relationships I have two custom post types one is session and the other is presentations. When a user creates a presentation I have a post object field named in_session and it lists all the sessions. I have another post object field named in_session for the session post type but it has the presentations as the post type to list. When the user creates the presentation post type they are asked to select what session it is going into and that shows up in the presentation field but i want that presentation title to show up as one of the many on the session post type. Can this plugin do this?
]]>Hi,
I find you plugin exciting, but I am not 100% if it provides the functionality I need.
Can you help me?: I’m using ACF 5, I created two CPTs and each of these has custom metafields. Now I need to display let’s say a custom metafield called “license_plate” from CPT1 to CPT2 and keep it updated/synchronized whenever the custom field “license_plate” of CPT1 changes. Does your plugin enable that functionality?
Thank you so so much ??
Lorenzo
I have added the Fields Exceptions snippet to my functions.php file, and have replaced field_XXXXXXXX with my key name, however, it is still automatically adding the bidirectional relationship automatically for that field.
Thoughts?
]]>Is there a way to bulk change existing relational posts into bi-directional? I currently have 2 post types that I want to connect bi-directionally, but it was originally set up with a single direction relationship. I have added the custom field to the other post type.
Unfortunately the only way I’ve been able to get them to connect to each other is to go into the post that originally had the fields to begin with, and hit Update. Then it shows up on both post types.
(I tried change the status to draft and back to publish in bulk editing, but that didn’t work. I also tried bulk adding a taxonomy to all of them. Didn’t connect them either.)
]]>i think the plugin is holding onto old “revisions” or post_status “inherit” instead of resaving it with the current published revision.
i’m not sure how else to explain it, but when I use it in conjunction with Search and Filter Pro, and call up that same “related_posts” meta I’m overwriting with this plugin, it seems to output dropdown filters with IDs of post revisions interspersed with the actual post.
]]>If post 1 has a relationship added to post 2, this plugin adds a reciprocal relationship to post 2.
But what if post 2 already had a relationship to post 3? Is that relationship preserved so that post 2 now has two relationships? I’m unclear.
]]>The plugin is wonderful and we look for further use cases.
So far our routine with the plugin is:
1. Manually insert regular WordPrress links to other posts in the post body; and then
2. Manually insert the linked posts into the ACF Post-2-Post meta box in order to relate them bidirectionally to the current post.
Is there a way to achieve these steps altogether, i.e. the ACF post-to-post relationship to be created automatically upon link creation?
Thank you very much!
]]>I stick to the example with author and books. In my case, the Relationship field allows me to assign several books to an author on the authors page, but a book can only be assigned to ONE author on the book page (also through out a relationship field). Example: I have assigned author 1 the book 1 – now if I assign the author 2 also the book 1, from my understanding book 1 should only be assigned to author 2 anymore. Then the previous author 1 should no more be seen as assigned on the book page. If that’s exactly what the overwrite settings should do, it will not work for me, even though I’ve stuck to all the guidelines: same key_name etc. In my example from above, according to the scenario described, on the book page both authors 1 and 2 are assigned. Was that understandable? :))
Or didn’t I understand correctly what the overwrite settings does? The code I used (I also checked the copy paste code):
add_filter('acf-post2post/overwrite-settings', 'my_overwrite_settings');
function my_overwrite_settings($settings) {
$settings['orte2partner'] = array(
'overwrite' => true,
'type' => 'first'
);
return $settings;
}
]]>
I stick to the example with author and books. In my case, the Relationship field allows me to assign several books to an author on the authors page, but a book can only be assigned to ONE author on the book page (also through out a relationship field). Example: I have assigned author 1 the book 1 – now if I assign the author 2 also the book 1, from my understanding book 1 should only be assigned to author 2 anymore. Then the previous author 1 should no more be seen as assigned on the book page. If that’s exactly what the overwrite settings should do, it will not work for me, even though I’ve stuck to all the guidelines: same key_name etc. In my example from above, according to the scenario described, on the book page both authors 1 and 2 are assigned. Was that understandable? :))
Or didn’t I understand correctly what the overwrite settings does? The code I used (I also checked the copy paste code):
add_filter (‘acf-post2post / overwrite-settings’, ‘my_overwrite_settings’);
function my_overwrite_settings ($ settings) {
??$ settings [‘orte2partner’] = array (
????‘overwrite’ => true,
????‘type’ => ‘first’
??);
??return $ settings;
}
I’m interested in translate this plugin to spanish, but as you can see at https://translate.www.ads-software.com/projects/wp-plugins/post-2-post-for-acf/ , the plugin is not properly prepared for localization.
Please, could you fix that?
Thanks
]]>https://prntscr.com/pcpu57 does not work!
]]>“The field must be at the top level. It cannot be a subfield of a repeater or a flexible content field.”
Hello, Is there any possibility or the roadmap to enable for using relationship field in a subfield, specially repeater?
Thank you.
]]>Your Plugins works really well, at least in most of my cases.
I have several custom post types (teams, players, sponsors) which are connected whitch each other.
If I add a player in the sponsor custom post type, the value will be saved. If I add the sponsor in the player custom post type and save it, the value is empty and overrides the already connected sponsor (this happens when I update other values whitin the player custom post type).
Field names are the same.
]]>When I create a bidirectional relation, between 2 elements,
this appears at all pages, even if I specify where to display
How can I fix this?… I hide it at admin-footer.php, but I can’t do this everytime I add a page or post
$(document).ready(function(){
var post = $(“#post_ID”).val();
if(post == 2 || post == 118 || post == 45 || post == 9498 || post == 21 || post == 9544 || post== 19 || post == 9541 || post == 11660 || post == 9406 || post == 9407 || post == 9407 || post == 9408 || post == 9411 || post == 9407 || post == 9408 || post == 9409 || post == 9410 || post == 9411
|| post == 9412 || post == 9413 || post == 9414 || post == 9415 || post == 9416 || post == 9417 || post == 9418 || post == 11660 || post == 9419 || post == 9420 || post == 9421 || post == 9422 || post == 9423 || post == 9424 || post == 9425 || post == 9426
|| post == 9427 || post == 9428 || post == 9427 || post == 9428 || post == 9429 || post == 9430 || post == 9431 || post == 9432 || post == 9433 || post == 9435 || post == 9663 || post == 9671 || post == 9668 || post == 9665 || post == 11662 || post == 9666 || post == 9669
|| post == 9675 || post == 9670 || post == 9678 || post == 9621 || post == 9684 || post == 9686 || post == 9677 || post == 9679 || post == 9667 || post == 9680 || post == 9676 || post == 9672 || post == 9681 || post == 9674 || post == 9683 || post == 9619 || post == 9620
|| post == 9618 || post == 9673
){
$(“#acf-group_5d3e47199eae3,#acf-group_5d31c32929941”).hide();
}
});
We use an import tool and this does not trigger a relationship on the other post type after programmatically adding/updating posts, please let me know how we can programmatically update all posts to trigger a bi-directional relationship.
Thanks!
]]>