This function will return a sub field object (within a has_sub_field loop). The returned array will look something like this:

    [key] => field_4fea85f5320da
    [label] => Text Field
    [name] => text_field
    [type] => text
    [instructions] => 
    [required] => 0
    [default_value] => 
    [formatting] => html
    [order_no] => 0


  • ACF version 4.0.0 or above


get_sub_field_object( $field_key )


The key or name of the field to be retrieved. eg “field_4fc5ab37e1819lol” or ”heading” (required)


The get_sub_field_object works in a similar way to get_sub_field. This means it must be used within a has_sub_field loop. Here is an example of how to find the sub field object of a ‘select’ field (called ‘select’ in this example) from a repeater (called ‘repeater’ in this example).

<?php if( get_field('repeater') ): ?>

	<?php while( has_sub_field('repeater') ): ?>


		// vars
		$select = get_sub_field_object('select');
		$value = get_sub_field('select');

			<?php foreach( $select['choices'] as $k => $v ): ?>
					<?php if( $k == $value ): ?>
						<span class="selected">Selected!</span>
					<?php endif; ?>
					<?php echo $v; ?>
			<?php endforeach; ?>

	<?php endwhile; ?>

<?php endif; ?>



We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.