Support

Account

Home Forums General Issues Hide a tab in flexible content by option on option field Reply To: Hide a tab in flexible content by option on option field

  • Not only would you need to hide the tab but you would also need to filter and hide all of the fields in that tab.

    You do not want to unset the field, you need to return false

    
    // Apply to fields named "example_field".
    	add_filter('acf/prepare_field/key=field_60647c32d82ce', 'hide_ani_tab');
    
    	function hide_ani_tab($field) {
    
    		if ( false == get_field( 'animation_option', 'option' ) ) {
    			// remove tab by field key
    			return false;
    		}
    
    		return $field;
    	}
    

    but as I said, this would need to be done for the tab and all of the fields in the tab