Adding option to Gallery shortcode
This code should work in your functions.php add_shortcode(‘gallery’, ‘custom_gallery_function’); function custom_gallery_function($atts) { $user = wp_get_current_user(); // if current user isn’t admin, add posts to be hidden to exclude if(!in_array(‘administrator’, $user->roles)) $atts[‘exclude’] = $atts[‘exclude’] . ‘,’ . $atts[‘hide’]; // call the wordpress shortcode function return gallery_shortcode($atts); }