Previously I always used the great plugin Posts 2 Posts from Scribu to connect posts to other pages etc. However I really like the nice ACF functionality and interface of the Relationship field.
There’s only one thing I’m really missing in the Relationship field equivalent of ACF and that is the option to add field(s) only for the particular relationship, similar like described here: Connection metadata.
Let’s say I have 2 post types called ‘project’ and ‘team’. For every project I would like to connect the team members that worked on that project. But for every project I would like to briefly describe what that team member did exactly on that particular project, so this could be different for every project.
I would be awesome if you could specify extra field(s) for every ‘connection’ you make in the relationship field. Is this something that would be doable with ACF?
I created a plugin about 6 months ago that does this, but hasn’t had much use. I wouldn’t mind input on it. https://github.com/Hube2/acf-post2post. It will automatically work for posts of the same post type and if a relationship field with the same field name is added to other post types it will work for that as well. If you try it and have question or comments please post create a new issue on github.
There isn’t any way in WP to define something for a specific connection between 2 posts.
This would require not one but 2 additional DB tables. The 1st table would a table holding one piece of information related to the relationship. The 2nd table would be a connector table that creates a many to many relationship. This table would have 3 columns, the first 2 columns would be the post IDs of the related posts and the 3rd columns would be the ID of the piece of information related to that relationship. Without these extra tables there is no construct within WP that allows for this complex data. The data must be stored as post meta associated with the post on one side of the relationship or the other.
This is far beyond what is possible using WP. ACF is nothing more than a wrapper for what is already possible using WP and does not really extend it. The only thing that ACF really does is to make is possible without us needing to code the admin of everything we want to change ourselves. It works inside of the box that is provided by posts an post meta.
The only thing that I can think of that comes close to this in WP w/ACF would be through the use 3 post types.
Lets look that the idea in the OP. There is a post type called “projects” and a post type called “team members”. We add to this a 3rd post type called “member role” (or something like that). You populate the members, then you add a project. Then you add project roles and this is where the relationships is formed created a many to many relationship between projects and team members.
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!