SOLVED: AJAX popups with loop context return 403 for visitors since Bricks 2.4.4 (CPTs without single pages)

Who is affected: custom post types that you show in query loops but registered without single pages ('publicly_queryable' => false, e.g. team members, FAQs, locations). If such a loop opens an AJAX popup with the loop post as context, logged-out visitors get “Popup data not found” (403). While you’re logged in as an admin or editor everything works, so it’s easy to miss.

What doesn’t help: setting 'publicly_queryable' => true. That makes the popup work again but also opens single pages for that post type.

Workaround: treat the post type as viewable only inside the popup request:

add_filter( 'is_post_type_viewable', function ( $is_viewable, $post_type ) {
	if ( $is_viewable === true ) return true;
	if ( ! $post_type instanceof WP_Post_Type ) return false;

	// Post types shown in query loops, but without single pages
	if ( ! in_array( $post_type->name, [ 'team_member', 'location' ], true ) ) return false;

	return class_exists( '\Bricks\Api' ) && \Bricks\Api::is_current_endpoint( 'load_popup_content' );
}, 10, 2 );

Notes:

  • Always return a strict bool. WordPress compares the filtered value with === true.
  • WordPress’ status check stays in place: drafts, private and password-protected posts are still refused.
  • Only add post types whose content is public in your loops anyway.

To test it, open the page with the loop in a private window and open the popup.

A dedicated Bricks filter for allowed popup contexts would make this cleaner.

Best Regards
Suat

Thanks @UserfreundSuat

I reproduced the issue and we are working on it.

I wasn’t sure if this was the intended behaviour and since i build a lot of projects with this kind of interaction, I wrote this workaround and thought maybe other people may be effected too and posted it in the how-to category.

But I’m happy to see this being fixed then.

Best Regards
Suat

We’ve addressed this in Bricks 2.4.5, now available as a one-click update in your WordPress Dashboard.

Logged-out visitors can now open AJAX popups for published entries of custom post types without single pages, so the is_post_type_viewable workaround can be removed after updating.

Please read the changelog entry before updating, and let us know if you experience any issues.