Home › Forums › ACF PRO › disable media library on front end form › Reply To: disable media library on front end form
I found a bit cleaner solution that doesn’t require the basic uploader – use the nice uploader and just stop the Media Library itself from loading.
// Conditionally don't load the Media Library tab/ content
function remove_medialibrary_tab($strings) {
if ( !user_is_admin() ) {
unset($strings["mediaLibraryTitle"]);
return $strings;
} else {
return $strings;
}
}
add_filter('media_view_strings','remove_medialibrary_tab');
// Conditionally don't run the Media Library's initializing AJAX
function restrict_non_Admins(){
if( !user_is_admin() ){
exit;
}
}
add_action('wp_ajax_query-attachments','restrict_non_Admins',1);
add_action('wp_ajax_nopriv_query-attachments','restrict_non_Admins',1);
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.