admin管理员组

文章数量:1410717

I want to display user's locations which they travelled on author box so how can I add this kind of input area to users profile? To more explain, If a user add "Londra,Paris" to own profile, these cities will seem author box as a tag.Londra and Paris must be entered to different areas so users can add extra fields. If it is impossible, how can I divide cities which form of "Paris,Londra" to use in city tags. I talk about divide all words by ,. I hope I could explain me.

Or explode lines like Hello Kity, and the function counts how many is there location

I want to display user's locations which they travelled on author box so how can I add this kind of input area to users profile? To more explain, If a user add "Londra,Paris" to own profile, these cities will seem author box as a tag.Londra and Paris must be entered to different areas so users can add extra fields. If it is impossible, how can I divide cities which form of "Paris,Londra" to use in city tags. I talk about divide all words by ,. I hope I could explain me.

Or explode lines like Hello Kity, and the function counts how many is there location

Share Improve this question edited Jan 10, 2020 at 16:05 nmr 4,5672 gold badges17 silver badges25 bronze badges asked Jan 10, 2020 at 15:32 ahmet taşahmet taş 11 bronze badge
Add a comment  | 

2 Answers 2

Reset to default 0

You should look at the add_user_meta function to capture the info from the user. Then you can lookup the value using get_user_meta.

Use this link for more info: https://developer.wordpress/reference/functions/add_user_meta/

You can divide the cities using explode function of php. It convert the strings to array on base of character added in the parameter. You can split the string on base of comma and print the location separately. Please use explode(",",$locations);

However, you can also use repeater field of acf. In this way users can add as many field as they wants. Please see the link here acf repeater field

本文标签: phpHow to add locations input to user profile