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