Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created April 23, 2024 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xlplugins/4a09f582c2904650e36d2e8f7cc7e649 to your computer and use it in GitHub Desktop.
Save xlplugins/4a09f582c2904650e36d2e8f7cc7e649 to your computer and use it in GitHub Desktop.
Change Dropdown Values
class WFACP_Change_Dropdown_Values {
public function __construct() {
add_filter( 'wfacp_admin_order_field', [ $this, 'change_options' ], 30 );
add_filter( 'wfacp_forms_field', [ $this, 'change_options' ], 30 );
}
public function change_options( $field ) {
if ( in_array( $field['type'], [ 'select', 'dropdown' ] ) ) {
$new_options = [ '' => '' ];
foreach ( $field['options'] as $key => $option ) {
$new_options[ $option ] = $option;
}
$field['options'] = $new_options;
}
return $field;
}
}
new WFACP_Change_Dropdown_Values();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment