Home › Forums › Add-ons › Gallery Field › ACF PRO Gallery: restrict view own Media › Reply To: ACF PRO Gallery: restrict view own Media
Thx John… copy that – you are absolutely right. But why I’m wondering was the fact that the new Post will show the image from another author but not the gallery items.
we are using the following action to restrict users fro their own media/posts:
if( is_admin() && !current_user_can('edit_others_posts') ) {
$wp_query->set( 'author', $current_user->ID )...
With this function we normale did’t see the ACF groups in a post too.
so we were using this snippet
if (isset($wp_query->query_vars['post_type']) &&
($wp_query->query_vars['post_type'] == 'acf-field' ||
$wp_query->query_vars['post_type'] == 'acf-field-group'
)) { return; }
and to fix the problem with the Gallery we were adding on more condition:
if (isset($wp_query->query_vars['post_type']) &&
($wp_query->query_vars['post_type'] == 'acf-field' ||
$wp_query->query_vars['post_type'] == 'acf-field-group' ||
($pagenow == 'post.php')
)) {return; }
cheers
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.