Created
July 21, 2020 17:47
-
-
Save FerFuego/86b745450382f454ced57d1f82aaab90 to your computer and use it in GitHub Desktop.
Example update user meta ACF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$user_id = wp_get_current_user()->ID; | |
update_user_meta( $user_id, 'first_name', $_POST['user_firstname'] ); | |
update_user_meta( $user_id, 'last_name',$_POST['user_lastname'] ); | |
update_user_meta( $user_id, 'linkedin', $_POST['user_linkedin'] ); | |
update_user_meta( $user_id, 'facebook', $_POST['user_facebook'] ); | |
update_user_meta( $user_id, 'instagram', $_POST['user_instagram'] ); | |
update_user_meta( $user_id, 'twitter', $_POST['user_twitter'] ); | |
update_user_meta( $user_id, 'biography', $_POST['user_description'] ); | |
update_user_meta( $user_id, 'education', $_POST['user_education'] ); | |
//json of [specialties, subspecialties] | |
$bb_specialties = json_decode(stripslashes($_POST['user_specialty'])); | |
update_user_meta($user_id, 'bb_specialties', count( $bb_specialties ), false); | |
$i = 0; | |
foreach( $bb_specialties as $bb_sp) { | |
update_user_meta($user_id, 'bb_specialties_'.$i.'_specialty', $bb_sp->specialty, false); | |
update_user_meta($user_id, 'bb_specialties_'.$i.'_subspecialty', $bb_sp->subspecialty, false); | |
$i++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment