I’m trying to limit the number of posts in a relationship field by year and I need to query the titles in a relationship field from the same year of the current post. But somehow this doesn’t work for me:
function custom_acfrelationship_query( $args, $field, $post_id ) {
global $post;
$args['year'] = get_post_time( 'Y' );
return $args;
}
add_filter('acf/fields/relationship/query', 'custom_acfrelationship_query', 10, 3);