Created
April 23, 2024 11:48
-
-
Save xlplugins/4a09f582c2904650e36d2e8f7cc7e649 to your computer and use it in GitHub Desktop.
Change Dropdown Values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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