Home Forums General Issues Nested Relationship Fields


Nested Relationship Fields

  • Hi,

    How would I nest a relationship field? The page that the script below would run on, has a number of featured services in a relationship field. Those featured services, in turn, have a featured demo associated with them via a relationship field.

    $service_list = get_field('featured_services');
    if( $service_list ) {
    	foreach( $service_list as $services_item ){
    		the_field('name', $services_item);
    		$demo_list = get_field('featured_demos');
    			if( $demo_list ){
    				foreach( $demo_list as $demo_item ){
    					the_field('soundcloud_id', $demo_item);
  • Hi @andycheeseman

    You would load your demo list by targeting the correct post like so:

    $demo_list = get_field('featured_demos', $services_item);


Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Nested Relationship Fields’ is closed to new replies.