I’m using wordpress with Advanced Custom Fields plugin v4.4.2
I need to modify the user select fields, so that it displays not only display_name
, but also the user_login
.
I found the bit of code that handles this, and it is here:
wp-content/plugins/advanced-custom-fields/core/fields/user.php on line 223
And i changed the default code from:
$field['choices'][ $label ][ $user->ID ] = ( $user->display_name );
to:
$field['choices'][ $label ][ $user->ID ] = ucfirst($user->user_login) . ' - ' . ucfirst( $user->display_name );
Now, everything’s working fine, but, as you probably already know, changing core files it’s not the best way to modifying things in wordpress, but i have to use filters or actions.
Now, simple question, is there a filter or action that allows me to change this bit?
I searched a lot but i couldn’t find anything useful.
thanks for your help.
I quickly go through this plugin and I found that (although I haven’t tested this) :
There is a filter acf/load_field_defaults. This filter hook can be used for this purpose.