I’ve created a form that contains upload and gallery fields.
Upload field works fine, instead the gallery field generates a query error when I click on “Add to gallery” button.
If I logged in, the gallery field works and media popup appears.
This is the jQuery error that I see in js console
[Error] TypeError: undefined is not an object (evaluating ‘wp.media.query’)
popup (acf-input.min.js, line 1)
add_attachment (acf-pro-input.min.js, line 1)
(funzione anonima) (acf-input.min.js, line 1)
dispatch (jquery.min.js, line 3)
handle (jquery.min.js, line 3)
I would that gallery field works in frontend form, without the user is logged in.
Can you help me?
It does not appear that the gallery field works when not logged in. I’ve tried everything I can think of here.
Your bet for doing this if you want to allow the user to create a gallery on the front end without being logged in would be to give them a repeater field with image fields for uploading multiple images and then to create an acf/save_post action to take the images from the repeater and add them to the gallery field.
The problem is that in order to use the gallery field the user has to have access to the media library. Any user type that does not have access to editing the media library will cause a JS error.
I think this means that the user must be at least a contributor, maybe an author.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.