ACF – User.php filter or aciton

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:

Read More

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.

Related posts

1 comment

  1. 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.

    I found this in file core/fields/_functions.php line number 546

Comments are closed.