Home › Forums › Backend Issues (wp-admin) › Change file upload path for one specific field. › Reply To: Change file upload path for one specific field.
Is it possible? Honestly, I don’t know, but think it is. I can’t give you specifics on doing it but I can try to point you in the right direction.
When you click on the field to add an image ACF does an AJAX request that causes the media library modal to open.
To filter the files shown you need to create a pre_get_posts filter https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts.
In this filter you need to see if it is an AJAX request and you need to look at the $_POST values submitted. $_POST will contain the field key of the field that the request is being done for.
Sorry I can’t give you any more details than this, it has been a very long time since I’ve looked at doing something like this. I do know that there is a forum topic that has more specific information…….
Did another look, and found it https://support.advancedcustomfields.com/forums/topic/filter-gallery-items/
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!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.