Bricks + ACPT relation provider doesn’t get current post ID in single templates (no results or all items)

Possibly a bug in the Bricks–ACPT integration (relation provider context issue).

I’m posting here for developer-level review.


Setup:

  • Two CPTs via ACPT: course (parent) and lecturer (child).

  • Relation field: info-about-course_lecturer (added to course, points to one or more lecturer posts).


Expected:

In the single course template, a Query Loop using the relation provider (e.g. Course → info-about-course_lecturer) should list only the related lecturers.

Actual:

  • Relation provider returns nothing.

  • “Posts → Lecturer” returns all lecturers (ignoring the relation).

  • ACPT meta data is fine:

info-about-course_lecturer => array(0 => '65', 1 => '69')

Reference:

ACPT docs mention {post_id} is required →

…but in Bricks there’s no visible “Post ID” field in the relation query UI, so the query runs without context.

Workaround (works perfectly):

add_filter('bricks/posts/query_vars', function ($qv, $settings) {
  $is_builder = function_exists('bricks_is_builder') && bricks_is_builder();
  $current_id = $is_builder && function_exists('bricks_get_preview_post_id')
    ? (int) bricks_get_preview_post_id()
    : (is_singular('course') ? (int) (get_the_ID() ?: get_queried_object_id()) : 0);

  if (!$current_id) return $qv;

  $post_type = $qv['post_type'] ?? null;
  $is_lecturer_loop = (is_string($post_type) && $post_type === 'lecturer')
    || (is_array($post_type) && in_array('lecturer', $post_type, true));
  if (!$is_lecturer_loop) return $qv;

  $ids = get_post_meta($current_id, 'info-about-course_lecturer', true);
  if (is_array($ids)) $ids = array_filter(array_map('absint', $ids));
  if (empty($ids)) { $qv['post__in'] = [0]; return $qv; }

  $qv['post__in'] = $ids;
  $qv['orderby']  = 'post__in';
  return $qv;
}, 10, 2);

Question:

Can Bricks automatically pass the current post ID to relation queries in single templates, so we don’t have to patch it manually?

Or is there a specific way to pass {post_id} that’s currently undocumented for ACPT relations?

Thanks — hope this helps others using ACPT + Bricks together.