I state that I am not a developer, for a new project, I need to create a dynamic ACF field that takes data from an input on the frontend.
Basically, in the frontend, the user has a simple URL field where he has to enter the address of his (her) websites.
Whenever he enters one, the URL should generate a choice in a select field or textarea on ACF in the backend.
This is because, then I need to retrieve the data of that ACF select in the backend, to show it in a select in the frontend.
In your opinion, which field is best to use in ACF (select or textarea)? What code can I use?
Thanks.
CodePudding user response:
It is a little long for comment.
You have ACF documentation here how to use fields in frontend (and backend). You can paste this code on your frontend
<?php the_field('your_field_name'); ?>
And now select or textarea?
- Select restrict user to add custom text values, you restrict them to use only choices that you gave to him
- Textarea let user to add anything that they want
Hope this is help
CodePudding user response:
By using select Maybe we can perform this task. Steps are following :
- Take input from User
- Use update_option and send serialized data and store values on ajax or form submit
- Prepopulate Select by a suggested method https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/
Hope this will work for you.
