Support

Account

Home Forums General Issues Reverse Relationship: Page & Custom Post Type Reply To: Reverse Relationship: Page & Custom Post Type

  • OK, I managed to solve it by myself… the main problem was, that I used the name of the custom post type instead of the name of the ACF-relationship-field.

    	$methods = get_posts(array(
    		'post_type' => 'page',
    		'meta_query' => array(
    			array(
    			'key' => 'persons', // name of custom field
    			'value' => '"' . get_the_ID() . '"', // matches exaclty "123", not just 123. This prevents a match for "1234"
    			'compare' => 'LIKE'
    			)
    		)
    	));