Support

Account

Home Forums Add-ons Repeater Field Set Dynamic Placeholders for Sub Fields Reply To: Set Dynamic Placeholders for Sub Fields

  • Hi @fatmedia

    Sure. The easiest way to do this is to use the ACF filter called acf/load_value.

    You will find docs for this on the documentation page. Use it to hook into any value loaded for the repeater field.

    If the value is empty, this means that the post must be a new one, in this case, you can modify the value to trick ACF into rendering 3 rows of data.

    All you need to do is set the value to this format:

    
    $value = array(
    	
    	array(
    		'field_123' = 'Placeholder Title',
    		'field_456' = 'Placeholder text here...'
    	),
    	
    	array(
    		'field_123' = 'Another Placeholder Title',
    		'field_456' = 'Different Placeholder text here...'
    	),
    	
    	array(
    		'field_123' = 'Yet Another Placeholder Title',
    		'field_456' = 'Another Different Placeholder text here...'
    	)
    	
    );
    

    When editing the field group, you can toggle on ‘show field keys’ via the screen options menu tab. This will give you the sub field keys for field_123 and field_456.

    Hope that helps.

    Thanks
    E