Home Forums Add-ons Flexible Content Field Flexible Content – How to auto show minimum required layout fields. Reply To: Flexible Content – How to auto show minimum required layout fields.

  • @JohnHuebner

    Thanks for this! Works perfectly.

    I understand about the work needed, which was my thought as well.

    After testing this out, perhaps not as much works as anticipated?

    Without actually loading any defaults, meaning to simply trigger the layout to be visible upon page load, if value is NULL this is all that is needed.

    add_filter('acf/load_value/name=FLEXIBLE_FIELD_NAME_HERE', 'NAME_OF_YOUR_FUNCTION', 20, 3);
    function NAME_OF_YOUR_FUNCTION($value, $post_id, $field) {
    	if ($value == NULL) {
    		$value = 
    		[0 =>
    				'acf_fc_layout' => 'FLEXIBLE_LAYOUT_NAME_HERE',
    		return $value;

    Any ‘key’ => ‘value’ below ‘acf_fc_layout’ will be relative to the fields in that particular layout.

    Thank you deeply brother for your other information regarding the support flow and yourself 😉 I much appreciate it.

    I think for now then, because this was actually rather simple and lighter than expected, I will leave it not requested as a feature.

    And one the main reasons for me initially going back to check out ACF was the nav menu fields. But of course I’ve chosen to stay and migrate (which I have already done) because there is a lot more. ACF 5 is the version I mention. The JSON option also interests me. I understand JSON from tweaks, etc., but have not worked with it personally. But it is on my list and now I have something to go along in that learning.