Support

Account

Home Forums Backend Issues (wp-admin) modify relashionship field to be able to search user meta

Helping

modify relashionship field to be able to search user meta

  • Hi, i have ACF pro and i love it!

    well my issue is that i have a users profile with a custom field made with ACF it is a users telephone to be precise, now i have a custom post type in which i would like to relate this post type with the user but in the form of the post type to be able to search the user not only by its name or email (as ACF currently works) but also by phone number stored in this custom field.

    now as far as i know this field stores data in user meta table and i would like to know how to modify or create a new custom acf relashionship field type to be able to work like this.

    i have found a topic on creating custom field types as a plugin, but i have ye to understand where and how i would modify for it to query the usermeta fields and get my result.

    thanks for any help provided.

  • The following hooks exist, but appear to be undocumented

    acf/fields/user/query
    acf/fields/user/query/name={$field_name}
    acf/fields/user/query/key={$field_key}

    there are 3 parameters, $args, $field & $post_id

    https://codex.wordpress.org/Function_Reference/get_users

    It works the same way as https://www.advancedcustomfields.com/resources/acf-fields-relationship-query/

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘modify relashionship field to be able to search user meta’ is closed to new replies.