Skip Navigation

[Resolved] Can I use the same custom field for users and posts?

This support ticket is created 2 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by himanshuS 2 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#2154553

I am building a job board and have created a custom field called currency that allows the employer to enter the 'salary currency' in the 'Job' post by creating a custom post field called currency.

Now, I want the job seeker to tell me their salary currency in the user custom field. First, the field created for 'Job' CPT did not show up in the user custom field suggested fields. Second, when I tried to create a custom user field for job seekers with the same slug 'currency' I could not save it.

Can I use the custom field on both post and user. If not, why can't I create another field with the same slug for the user? Are they not considered separate in WordPress?

#2154799

No, the system will not allow two fields with identical slugs, regardless of whether they are used in User profiles or custom fields. If you create a proxy post type for Users, you could assign the same field group to the proxy post type: https://toolset.com/course-lesson/how-to-create-custom-searches-and-relationships-for-users/
Otherwise, there is not a simple way to directly associate the same custom field slug to a custom post type and a User profile.

#2154915

That's an interesting workaround. I am gonna keep user data in user meta and use different custom fields to make it work. This seems like a design thing with WordPress but it is what it is.

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.