Home › Forums › General Issues › Filter relationship field on taxonomy term page based on term › Reply To: Filter relationship field on taxonomy term page based on term
Hi @timo
For the tax_query
, change your code to the following:
function my_relationship_query( $args, $field, $post )
{
// increase the posts per page
$args['posts_per_page'] = 10;
$args['tax_query'] = array(
array(
'terms' => '30'
)
);
return $args;
}
Check out this link for more information: https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
For accessing the term object id dynamically, you could consider using get_queried_object()
function. Here is the link to the documentation: https://codex.wordpress.org/Function_Reference/get_queried_object
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.