Hi Elliot, it’s probably my fault, but I am not able to exclude the current post from the field. I have a very strange issue here, here is is my code:
add_filter('acf/fields/relationship/query', 'exclude_id', 10, 3);
function exclude_id ($args) {
$current_id = $_GET['post'];
$args['post__not_in'] = array($current_id);
return $args;
}
This doesn’t work, but if I hardcode the id (e.g. $args[‘post__not_in’] = array( 115 ); ) I obtain the exclusion.
I tried to substitute $_GET with:
$current_id = (int) $_GET['post'];
$current_id = intval($_GET['post']);
global $post;
$current_id = $post->ID;
But I had no luck..