When your website means business.

ACF, CPT, WP Query | Type: PHPCPT to CPT Reverse Query

Reverse query from different post types associated via ACF relationship field.


$offices = get_posts(array(
    'post_type' => 'office',//other post type we're getting data from
    'meta_query' => array(
            'key' => 'personnel', //name of custom field from above post type
            'value' => '"'.get_the_ID().'"'.
            'compare' => 'LIKE'
if( $offices ):
    foreach( $offices as $office ):
        Do stuff

Reference Links

We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Cookies Notice