Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
Use this filter to conditionally load collapsible sections as open, open all collapsible sections, or a specific target section.
Usage
add_filter( 'frm_section_is_open', '__return_true' );
Parameters
- $open (boolean)
- $field (array | object)
Examples
Always open sections
add_filter( 'frm_section_is_open', '__return_true' );
Open a target field
add_filter( 'frm_section_is_open', 'open_section_for_target_field', 10, 2 );
function open_section_for_target_field( $open, $field ) {
$target_section_id = 18635; //Replace 18635 with the section field ID
$id = is_object( $field ) ? $field->id : $field['id'];
if ( (int) $id === $target_section_id ) {
$open = true;
}
return $open;
}
Open all sections in a target form
add_filter( 'frm_section_is_open', 'open_section_for_target_form', 10, 2 );
function open_section_for_target_form( $open, $field ) {
$form_id = is_object( $field ) ? $field->form_id : $field['form_id'];
$target_form_id = 1012; //Replace 1012 with your form ID
if ( (int) $form_id === $target_form_id ) {
$open = true;
}
return $open;
}