I’m trying to figure out the best way to use ACF to add custom user meta fields to the User Profile (user-edit.php) screen/page and no other page? What is the best way to do this?
That depends on what version of ACF you’re using.
ACF5 (Pro) has a location rule for the user add/edit page, this would be my choice.
For ACF4, you may be able to create a custom location rule, but, to be honest, I’m not entirely sure it’s possible at all with this version. You might need to add a custom post type for holding user information and put a user field on that post type that relates the post to the user and then to get the values you’d need to search the posts for the post for that user. You’d also need to set the post type up so that the user can edit it. There’s a lot of work here, ACF5 Pro would be well worth the investment for just the ability to add fields to the user profile page.
I’m using ACF 5.3.5
So are you saying that for the Location Rules, I should set the “Show this field group if” setting to: “User Form” -> “is equal to” -> “Add/Edit”.
What does the “User Form” indicate/mean and what does the “Add/Edit” setting indicate/mean? I tried finding these references within ACF documentation and I couldn’t seem to locate any information on these specific settings.
Also, thank you for the help. It’s much appreciated 🙂
User form is any user form, there are basically only 2, register and add edit. You can see the register form if you set your site up so that anyone can register to the site. The add edit for is the user edit form that you see if you as an admin add or edit a user or a user edits their own profile.
Sorry to resurrect this thread but is it also possible to only display the custom ACF User fields for certain user Roles in the add/edit view?
You need to set the location rules for the field group to include what user types it is shown form.
User Form is equal to Add/Edit 'and' Current User Role is equal to Administrator 'and'
If you want this available to multiple user types you would need to add and
OR location rule
OR User Form is equal to Add/Edit 'and' Current User Role is equal to Editor'and'
Hi, I created a “country” ACF and I want to show it only on the dashboard/user details. I´ve set “User Form is equal to Add/Edit” but it is not showing there.
Otherwise the country field appears everywhere!! Like in the Post editing page, lol.
Thanks for reading,
What are your location rules set to? Will need to see the full list.
Hi! thanks so much for your interesting in helping me!
I’m having trouble understanding the location rules, which ones would refer to the WP dashboard? There’s nothing in that list that would give me the hint of it.
I’ve only set “current user” equals “viewing backend”. (I’ve translated it from spanish since that’s my language, sorry).
I guess obviously that’s not enough, what would I need to put there so that the field is only visibile in the dashboard/User/profile page?
There are no location rules that are for the dashboard. ACF fields cannot be shown there. You can only show fields on pages made for editing something, post, term, user.
Thanks for your reply! What would be the “user” page then? I’m confussed.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2020 Advanced Custom Fields. Subscribe