Might be interesting to know that it’s to upload files without permissions if you do it through acf_form() in the front end. However then it will always use the regular upload input type rather than WordPress native.
Just some info for people that might find this topic.
I am also getting the same error as @tabboy but on line 10260 in acf-input.js. I have an Image field inside of a repeater and when I click on ‘Add Image’, I receive an “Uncaught TypeError: Cannot read ‘query’ of undefined” for the following:
var Query = wp.media.query( options.library );
I am using WordPress 5.2.4 and ACF Pro Version 5.8.6.
I would also like to mention that this is happening on a Charitable campaigns post in the backend. Here is a reference to that plugin: https://www.wpcharitable.com/extensions/charitable-ambassadors/
To test whether it has something to do with the repeater, I created a new field group with just an Image field to show on my campaign post but that also didn’t work so the repeater is not at fault. For some reason, the media modal is not opening up as it should.
I have tried this on both Chrome and Firefox with no luck.
Any help is much appreciated! Thank you!
I have read all the post. Have the same problem, but inside the editor of pages (where my admin upload posts.. not public)
The error raises upon pressing the “upload image” button. No dialog appears.
Console error is:
acf-input.min.js?ver=5.8.7:3 Uncaught TypeError: Cannot read property 'query' of undefined at n.addFrameStates (acf-input.min.js?ver=5.8.7:3) at n.initialize (acf-input.min.js?ver=5.8.7:3) at n.e (acf-input.min.js?ver=5.8.7:1) at n.acf.Model (acf-input.min.js?ver=5.8.7:1) at n [as constructor] (acf-input.min.js?ver=5.8.7:1) at new n (acf-input.min.js?ver=5.8.7:1) at Object.acf.newMediaPopup (acf-input.min.js?ver=5.8.7:3) at n.selectAttachment (acf-input.min.js?ver=5.8.7:2) at n.onClickAdd (acf-input.min.js?ver=5.8.7:2) at n.<anonymous> (acf-input.min.js?ver=5.8.7:1)
Wordpress ver 5.3.1
All plugins updated
any ideas? I’m driving mad.
So the solution for me was to install the extension and luckily that fixed everything.
Are you editing WordPress pages or pages from a plugin? If it is from a plugin, I would try contacting them.
Best of luck!
Hello, I receive exactly the same error: I am using the gallery field in a front end form. When clicking on “Add to Gallery” nothing happens, the Chrome console throws the following error message (see below). Adding the line “wp_enqueue_media();” in the page template before the ACF form leads to the exact error (displayed in the front end media upload form) mentioned by Karush, i.e. “Sorry you are not allowed to upload files”.
What else can I do? I am using the latest ACF Pro 5.11.4 version.
“acf-input.min.js?ver=5.11.4:1 Uncaught TypeError: Cannot read properties of undefined (reading ‘query’)
at n.addFrameStates (acf-input.min.js?ver=5.11.4:1)
at n.initialize (acf-input.min.js?ver=5.11.4:1)
at n.e (acf.min.js?ver=5.11.4:1)
at n.acf.Model (acf.min.js?ver=5.11.4:1)
at n [as constructor] (acf.min.js?ver=5.11.4:1)
at new n (acf.min.js?ver=5.11.4:1)
at Object.acf.newMediaPopup (acf-input.min.js?ver=5.11.4:1)
at n.onClickAdd (acf-pro-input.min.js?ver=5.11.4:1)
at n.<anonymous> (acf.min.js?ver=5.11.4:1)
at HTMLAnchorElement.i (jquery.min.js?ver=3.6.0:2)”
My issue was related to incorrect registering of the fields through PHP. I needed the field to show in two locations and issue was related to incorrect array nesting of the ‘location’ property. Here’s the working example.
acf_add_local_field_group([ 'key' => 'G1570820135490', 'title' => 'Extras', 'fields' => $fields, 'location' => [ [ [ 'param' => 'nav_menu_item', 'operator' => '==', 'value' => wp_get_nav_menu_object('mega')->term_id, ] ], [ [ 'param' => 'nav_menu_item', 'operator' => '==', 'value' => wp_get_nav_menu_object('mega-australia')->term_id, ], ], ], 'menu_order' => 0, 'position' => 'normal', 'style' => 'seamless', 'label_placement' => 'top', 'instruction_placement' => 'label', 'active' => true, ]);
The topic ‘Uncaught TypeError: Cannot read property 'query' of undefined’ is closed to new replies.
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!