Exclude specific media/post ID from media library plugin?

Question

I have a multisite setup and I use a plugin called Multisite Global Media https://github.com/bueltge/multisite-global-media

I have a specific site ID set that shares the complete media library with all other sites. This works great. But I have a specific file I don’t want to share with every other site. So my wish is to exclude this specific file from the plugin. And the reason I ask here is I think the function required to do this is not plugin specific?
Can I somehow query by filename with the $_POST?

This is the current code, and lets say the file I want to exclude is called Title.png.

function global_media_user_cap($allcaps, $caps, $args, $user) {
    if( !in_array('upload_files', $args) )
        return $allcaps;
    if( defined('DOING_AJAX') && DOING_AJAX && isset($_POST['action']) && $_POST['action'] == 'query-attachments' ) {
        if( function_exists('MultisiteGlobalMediagetSideId') ) {
            if( MultisiteGlobalMediagetSideId() == get_current_blog_id() ) {
                $allcaps['upload_files'] = 1;
            }
        }
    }
    return $allcaps;
}
add_filter( 'user_has_cap', 'global_media_user_cap', 99, 4 );

Can I exclude it somewhere in the if?

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/exclude-specific-media-post-id-from-media-library-plugin/">

Exclude specific media/post ID from media library plugin?</a>
0
, , jockebq 2 months 0 Answers 52 views 0

Leave an answer