• Resolved Howdy_McGee

    (@howdy_mcgee)


    I have a custom post type and a custom WP_Query. Is there a way to hide posts / not query posts in which the current user with their groups do not have access to view?

    For example, Post A is only viewable by Group A. The current user is in Group B.

    When I query posts, I don’t want to query Post A since the current user, in Group B, cannot view that post.

Viewing 1 replies (of 1 total)
  • Thread Starter Howdy_McGee

    (@howdy_mcgee)

    Looks like it can be achieve with a meta_query

    'meta_query' => array( array(
        'key' => 'groups-read',
        'value' => $user_group_ids,
        'compare' => 'IN',
    ) )
Viewing 1 replies (of 1 total)
  • The topic ‘Query Posts by Viewable Groups’ is closed to new replies.