Home › Forums › General Issues › Duplicate user metadata field to custom field – possible? › Reply To: Duplicate user metadata field to custom field – possible?
Do you want these fields to be visible an editable when the product is edited? If you store them in ACF fields in each product they will be.
I’m guessing that you don’t want the user to be able to edit these fields. In that case you’d need to use standard WP function.
Create a WP save_post filter https://codex.wordpress.org/Plugin_API/Action_Reference/save_post.
Get the pv_shop_name value using get_user_meta() https://codex.wordpress.org/Function_Reference/get_user_meta.
Store the value in the product post using update_post_meta() https://codex.wordpress.org/Function_Reference/update_post_meta
Then display the value on the front end using get_post_meta() https://developer.wordpress.org/reference/functions/get_post_meta/
If you do want these to be ACF fields that can be edited when viewing the post the process would be the same except that instead of update_post_meta() you would use update_field() using the field key of the acf field that you set up of the product page.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.