• Hi

    I am using ACF frontend to create a form which a user uses to create a post. I need to send the submiited form to a specific category based on the users location. So if the user is based in Liverpool the post will be submitted to a category called Liverpool and if their location is Manchester it would be submitted to a category called Manchester. The user can choose their location from a taxonomy field in the form.

    • This topic was modified 2 years, 6 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi, before recommending a solution, can you please let us know whether you use https://www.ads-software.com/plugins/acf-frontend-form-element/ or the acf_form PHP function for rendering the form on the front-end?

    Also, if you use another tool, please share details about it.

    • This reply was modified 2 years, 6 months ago by aatanasov.
    • This reply was modified 2 years, 6 months ago by aatanasov.
    • This reply was modified 2 years, 6 months ago by aatanasov.
    Thread Starter whenwebsiteswork

    (@whenwebsiteswork)

    Hi

    Thanks for your reply, i am using the ACF Frontend Plugin, I have found part of the solution, the ACF Frontend requires ACF to be installed, in ACF I created a taxonomy which creates a category which I then imported as a field in ACF frontend, you can’t do this directly in the frontend plugin. The user can now select categories from the frontend form to post in. The only problem I have now is the field in the frontend form shows every category on the site, I want to limit this just to show specific categories. As an example if have a parent categories such as ‘liverpool’ and ‘manchester’ which are cities, I just want the form to show these categories, not other categories for something else such as ‘BMW’ which is a car. Hope ive explained this ok

    Unfortunately, this feature isn’t supported by the ACF Frontend plugin.

    I’ve investigated the possibility of limiting the terms on the front end, but there is no such admin option available.

    Also, the main ACF plugin has a WordPress hook called acf/fields/taxonomy/query. However, it isn’t used by the ACF Frontend plugin. I’ve just tested the hook, and it only affects the fields added through the main ACF plugin, not these from the ACF Frontend plugin.

    Also, there are no other appropriate WordPress hooks that can be used for modifying the query of the taxonomy field.

    I recommend submitting a feature request to the ACF Frontend support area.

    You can request any of the following options:

    • Adding an option for selecting terms when the taxonomy field is used on the New Post Form admin page.
    • Implementing a WordPress hook inside the ACF Frontend plugin — it should allow theme authors to adjust the arguments of the taxonomy query.

    Please feel free to share my comment regarding the ACF query hook that works for the fields outside the forms.

    Thread Starter whenwebsiteswork

    (@whenwebsiteswork)

    Thanks for looking at this, just to clarify the field has been added in the main ACF plugin and then exported to front end where i chose the ACF field imported, but i will look to submit the feature request to the developers

    I’ve tested the plugin using the same approach (importing an existing field to a form). The acf/fields/taxonomy/query hook doesn’t work for the ACF Frontend forms either.

    Here are some helpful screenshots to illustrate the hook issue:
    – Form configuration (imported field): https://ibb.co/n1yffhg
    – Back-end field (shows only 1 category — filtered by the ACF query hook): https://ibb.co/X7fBKRt
    – Front-end field (shows all categories regardless of the applied filter): https://ibb.co/Xjpc0MJ

    When submitting the feature request, please feel free to share these screenshots along with the hook notes from my previous message.

    • This reply was modified 2 years, 6 months ago by aatanasov.
    • This reply was modified 2 years, 6 months ago by aatanasov.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Auto assign posts to a category using ACF Frontend’ is closed to new replies.