How to add fields in wp-usermeta table in wordpress?
- by admin
- 0
Inside a function or any where add below code :
add_user_meta(‘userid ”new_field_name’,’value’);
eg:
add_user_meta(‘1’, ‘bonus_points’,’1′);
Getting value from this field:
$user_current_points = get_user_meta(‘1’, ‘bonus_points’,’true’);
updating field:
update_user_meta(‘1’, ‘bonus_points’,’20’);
Inside a function or any where add below code : add_user_meta(‘userid ”new_field_name’,’value’); eg: add_user_meta(‘1’, ‘bonus_points’,’1′); Getting value from this field: $user_current_points = get_user_meta(‘1’, ‘bonus_points’,’true’); updating field: update_user_meta(‘1’, ‘bonus_points’,’20’);
Inside a function or any where add below code : add_user_meta(‘userid ”new_field_name’,’value’); eg: add_user_meta(‘1’, ‘bonus_points’,’1′); Getting value from this field: $user_current_points = get_user_meta(‘1’, ‘bonus_points’,’true’); updating field: update_user_meta(‘1’, ‘bonus_points’,’20’);