Home › Forums › Front-end Issues › ACF Form with Gallery Uploader › Reply To: ACF Form with Gallery Uploader
This is based on information provided here https://support.advancedcustomfields.com/forums/topic/filter-gallery-items/, and part of it is just guessing so let me know how it works out.
add_filter('ajax_query_attachments_args', 'restrict_images_to_user');
function restrict_images_to_user($query) {
if (isset($_POST['query']['_acfuploader']) &&
// use your field key here
isset($_POST['query']['_acfuploader'] == 'field_XXXXXXX') {
$author = get_current_user_id();
$query['author'] = $author;
}
return $query;
}
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.