Support

Account

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/