Home › Forums › General Issues › Relationship – Add categories / taxonomies to list
Hi, I was wondering if anyone has ever done this before or needed something similar.
Currently using the relationship field to output a slider and my client would like to start adding categories to the slider as well as pages and posts.
I could just add a taxonomy field but the disadvantage would be that the user would no longer be able to drag and drop the ‘slides’ into order and would have to work across two fields rather than one.
Is there a way to hook into the relationship field to allow this? There are a few tutorials about hooks but they are more about filtering.
Have added a screenshot of what I am hoping to achieve.
Hi @RichB
Thanks for the screenshot.
Adding a select for the taxonomy is on the to-do and you can expect to see it soon.
ACF contains a filter which you can use to modify the WP_Query args and filter the posts. You can read more here:
http://www.advancedcustomfields.com/resources/tutorials/customize-the-relationship-field-list-query/
+1 for this feature to be added.
I’m looking to get a list of all Tags in a Relationship-style of field, where the chosen list of tags can then be reordered, as we can with Posts currently.
Like RichB, the Taxonomy checklist/multiple select only gets me half way there.
I’ve been playing with the code in the link you provided Elliot but I am not having much luck so far.
Fingers crossed this will be added soon!
Any word on this one? It’s exactly what I need for an upcoming project. Relationship-style field for tags.
For what it’s worth, I ended up using a Taxonomy ‘post_tag’ field in a Repeater to achieve what I was looking for.
+1 for this feature, I need to generate a relationship to a taxonomy.
Hi guys i have a similar problem. I have a CPT with a relationship to pages. But the CPT has also various taxanomies. So I need the Output loop to list the relationship items to the taxonomies.
$posts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'materialien',
'order' => 'ASC',
'category' => 'medienform',
'include' => '',
'exclude' => '',
'key' => 'post-relationship',
'orderby' => 'post_date',
'meta_query' => array(
array(
'key' => 'post-relationship', // name of custom field
'value' => '"' . get_the_ID() . '"', // matches exactly "123", not just 123. This prevents a match for "1234"
'compare' => 'LIKE'
)
),
The topic ‘Relationship – Add categories / taxonomies to list’ is closed to new replies.
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.