Here is the code to allow your users to add phone numbers. Paste this full code in functions.php file. This will add new field on user profile for “Phone Number” and add a column user table on WordPress admin for phone.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | function new_contact_methods( $contactmethods ) { $contactmethods['phone'] = 'Phone Number'; return $contactmethods; } add_filter( 'user_contactmethods', 'new_contact_methods', 10, 1 ); function new_modify_user_table( $column ) { $column['phone'] = 'Phone'; return $column; } add_filter( 'manage_users_columns', 'new_modify_user_table' ); function new_modify_user_table_row( $val, $column_name, $user_id ) { switch ($column_name) { case 'phone' : return get_the_author_meta( 'phone', $user_id ); default: } return $val; } add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 ); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.