This code segment is aimed at fetching portfolio items while excluding the current post from the query results. It’s configured to retrieve posts of the ‘portfolio’ post type, with no limit on the number of posts per page (‘-1’ indicates all posts). The meta query ensures that only portfolio items associated with the current post ID are retrieved.

Put this code into Bricks Builder Query Editor options:

$current_post[] = get_queried_object_id();
return [
    'post_type' => 'portfolio', // e.g. faculty
    'posts_per_page' => -1,
    'meta_query' => array(
        array(
            'key' => 'portfolio_tim', // the ACF rel field
            'value' => get_the_id(),
            'compare' => 'LIKE'
        )
    ),
    'post__not_in' => $current_post,
];

The primary purpose of get_queried_object_id() is to fetch the ID of the currently queried object within the WordPress loop or when a specific object is queried.

Watch video tutorial here