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 customize an address field, such as removing the second line of the street address. It can also be used to add new sub fields.
Usage
add_filter( 'frm_address_sub_fields', 'remove_line2_from_address_field', 10, 2 );
Parameters
- $sub_fields (array) - list sub fields of the address field
- $field (array) - data for the current address field.
Examples
Remove Line 2 from address field
Use this code example to remove the second line of the Street Address from an address field.
add_filter( 'frm_address_sub_fields', 'remove_line2_from_address_field', 10, 2 );
function remove_line2_from_address_field( $sub_fields, $field ) {
$target_field_id = 5269; // change this.
if ( $target_field_id !== (int) $field['id'] ) {
return $sub_fields;
}
unset( $sub_fields['line2'] );
return $sub_fields;
}