I’ve got an acf field which is a post\_object. I’ve got it set to appear on every category page but I’m trying to add a filter hook which only allows posts to appear that are within the category I’m editing. I’ve tried to add the code below but it either doesn’t work, or it produces an error:
​
$tag_id = isset($_GET[‘tag_ID’])
? $_GET[‘tag_ID’]
: false;
add_filter(‘acf/fields/post_object/query/name=featured_products’, ‘my_acf_featured_product_filter’, 10, $tag_id);
function my_acf_featured_product_filter($args, $fields, $post_id) {
if ($post_id != false) {
$args[‘post_parent’] = $post_id;
return $args;
}
}
[The ACF Field with the location rules below])Does anyone know where I can look for more help or if someone has had this issue before and has found a solution I’m not seeing.
​
TIA
[ad_2]