Home › Forums › ACF PRO › Changing custom fields from page to custom post type › Reply To: Changing custom fields from page to custom post type
Hmm… The easiest way would be to write a PHP script to transfer the values from the old post the new post. The code would be something like this:
$field_key = '<field_key>'; // replace this with the actual field key
$old_post_id = <old_post_id>; // replace this with old post id
$new_post_id = <new_post_id>; // replace with new post id
// first get value from the old post
$value = get_field($field_key, $old_post_id);
update_field($field_key, $value, $new_post_id);
Hope this helps 🙂
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.