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.
This hook allows you to modify the order of options in a Lookup field.
Formidable Forms is the best WordPress Form Builder plugin. Get it for free!
Usage
add_filter('frm_order_lookup_options', 'frm_set_custom_lookup_order', 20, 2);
Parameters
- $values (array): all of the options in the Lookup field
- $order (string): the order selected in the Lookup field's options
Examples
Basic example
The following is a basic example that shows how you can modify the order of options in a Lookup field.
add_filter('frm_order_lookup_options', 'frm_set_custom_lookup_order', 20, 2);
function frm_set_custom_lookup_order( $values, $order ) {
if ( $order == 'ascending' ) {
sort( $values );
}
return $values;
}