Home › Forums › Front-end Issues › Add Custom User Meta to ACF Form Fields › Reply To: Add Custom User Meta to ACF Form Fields
I found a solution to my problem. I ended up using the wpmu_new_blog
action hook to update the post meta when a new blog is created.
Here is a basic idea of the code used:
add_action('wpmu_new_blog', 'katart_update_new_blog', 10, 2);
function katart_update_new_blog($blog_id,$user_id) {
switch_to_blog($blog_id);
$admin = get_userdata( $user_id );
update_post_meta( 4, 'custom_post_meta', $admin->custom_user_meta );
restore_current_blog();
}
This was a unique situation where I know the post ID. I hope this helps someone.
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.