<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WPWife &#187; restrict wordpress media library</title>
	<atom:link href="http://www.wpwife.com/category/restrict-wordpress-media-library/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wpwife.com</link>
	<description>WPHelp: fix and optimise WP themes&#38;plugins</description>
	<lastBuildDate>Fri, 21 Nov 2025 12:00:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.38</generator>
	<item>
		<title>How to Restrict Media Library Access to User’s Own Uploads in WordPress</title>
		<link>http://www.wpwife.com/wordpress-plugins/how-to-restrict-media-library-access-to-users-own-uploads-in-wordpress</link>
		<comments>http://www.wpwife.com/wordpress-plugins/how-to-restrict-media-library-access-to-users-own-uploads-in-wordpress#comments</comments>
		<pubDate>Tue, 14 Nov 2017 13:37:02 +0000</pubDate>
		<dc:creator><![CDATA[Editorial Staff]]></dc:creator>
				<category><![CDATA[restrict media library access for authors]]></category>
		<category><![CDATA[restrict wordpress media library]]></category>
		<category><![CDATA[wordpress media library]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[wordpress user media uploads]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=48047</guid>
		<description><![CDATA[
<p>By default, WordPress allows authors to see all images on your site&#8217;s media library. This could be problematic if you invite a lot of guest authors. In this article, we will show you how to restrict WordPress media library access to user&#8217;s own uploads. Why&#8230;&#160;<strong><a href="http://www.wpbeginner.com/plugins/how-to-restrict-media-library-access-to-users-own-uploads-in-wordpress/">Read More &#187;</a></strong></p>
<p>The post <a rel="nofollow" href="http://www.wpbeginner.com/plugins/how-to-restrict-media-library-access-to-users-own-uploads-in-wordpress/">How to Restrict Media Library Access to User&#8217;s Own Uploads in WordPress</a> appeared first on <a rel="nofollow" href="http://www.wpbeginner.com/">WPBeginner</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>By default, WordPress allows authors to see all images on your site&#8217;s media library. This could be problematic if you invite a lot of guest authors. In this article, we will show you how to restrict WordPress media library access to user&#8217;s own uploads. </p>
<p><img title="Restrict WordPress media library access to user&#039;s own uploads" src="http://cdn3.wpbeginner.com/wp-content/uploads/2017/11/restrictmedialibrary.png" alt="Restrict WordPress media library access to user&#039;s own uploads" width="550" height="340" class="alignnone size-full wp-image-48051" /></p>
<h4>Why Restrict Media Library Access to User&#8217;s Own Uploads?</h4>
<p>WordPress allows <a href="http://www.wpbeginner.com/glossary/author/" title="What is Author in WordPress?">authors</a> to see all files in the media library. They can also see images uploaded by an <a href="http://www.wpbeginner.com/glossary/administrator/" title="Administrator">administrator</a>, <a href="http://www.wpbeginner.com/glossary/editor/" title="Editor">editor</a>, or other authors. </p>
<p>To learn more, see our article on <a href="http://www.wpbeginner.com/beginners-guide/wordpress-user-roles-and-permissions/" title="Beginner’s Guide to WordPress User Roles and Permissions">WordPress user roles and permissions</a>.  </p>
<p>Let&#8217;s say you are creating a new post to announce an upcoming product or deal. Authors and guest authors on your website will be able to see the images you upload to that article in the media library. </p>
<p>Your uploads will also be visible on the &#8216;Add Media&#8217; popup which users see when adding images to their own articles. </p>
<p>For many websites, this may not be a big deal. However, if you run a <a href="http://www.wpbeginner.com/plugins/21-great-plugins-to-manage-multi-author-blogs-efficiently-and-successfully/" title="21 Plugins to Efficiently Manage WordPress Multi-Author Blogs">multi-author website</a>, then you may want to change this. </p>
<p>Let&#8217;s take a look at how to easily restrict media library access to user&#8217;s own uploads. </p>
<h4>Method 1: Restrict Media Library Access Using a Plugin</h4>
<p>This method is easier and is recommended for all users. </p>
<p>First thing you need to do is install and activate the <a href="https://wordpress.org/plugins/restrict-media-library-access/"  title="Restrict Media Library Access" rel="nofollow">Restrict Media Library Access</a> plugin. For more details, see our step by step guide on <a href="http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/" title="Step by Step Guide to Install a WordPress Plugin for Beginners">how to install a WordPress plugin</a>.</p>
<p>This plugin works out of the box, and there are no settings for you to configure. </p>
<p>Upon activation, it filters the media library query to see if the current user is an administrator or editor. If the <a href="http://www.wpbeginner.com/glossary/user-role/" title="What is User Role in WordPress">user role</a> does not match either of them, then it will only show user&#8217;s own uploads. </p>
<p>Users with the administrator or editor user role will be able to see all media uploads as usual. </p>
<h4>Method 2: Restrict Media Library Access Manually</h4>
<p>The first method would work for most websites as it limits media library access and allows only administrator and editor to view all media uploads.</p>
<p>However, if you want to add a <a href="http://www.wpbeginner.com/plugins/how-to-add-or-remove-capabilities-to-user-roles-in-wordpress/" title="How to Add or Remove Capabilities to User Roles in WordPress">custom user role</a> or simply don&#8217;t want to use a plugin, then you can try this method instead. It uses the same code used by the plugin, but you will be able to modify it to meet your needs.  </p>
<p>This method requires you to add code to your WordPress files. If you haven&#8217;t done this before, then take a look at our guide on <a href="http://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/" title="Beginner’s Guide to Pasting Snippets from the Web into WordPress">how to copy and paste code in WordPress</a>. </p>
<p>You&#8217;ll need to add the following code to your WordPress <a href="http://www.wpbeginner.com/glossary/functions-php/" title="What is functions.php File in WordPress?">functions.php</a> file or a <a href="http://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/" title="What, Why, and How-To’s of Creating a Site-Specific WordPress Plugin">site-specific plugin</a>. </p>
<pre class="brush: php; title: ; notranslate">
// Limit media library access
 
add_filter( 'ajax_query_attachments_args', 'wpb_show_current_user_attachments' );

function wpb_show_current_user_attachments( $query ) {
    $user_id = get_current_user_id();
    if ( $user_id &amp;&amp; !current_user_can('activate_plugins') &amp;&amp; !current_user_can('edit_others_posts
') ) {
        $query['author'] = $user_id;
    }
    return $query;
} 

</pre>
<p>This code uses current_user_can function to check if the user has the capability to activate plugins or edit other user&#8217;s posts. If they don&#8217;t, then it changes the query used to display media files and limit it to user&#8217;s ID. </p>
<p>We hope this article helped you learn how to restrict WordPress media library access to user&#8217;s own uploads. You may also want to <a href="http://www.wpbeginner.com/plugins/how-to-limit-authors-to-their-own-posts-in-wordpress-admin/" title="How to Limit Authors to their Own Posts in WordPress Admin">limit authors to their own posts</a> in WordPress admin area. </p>
<p>If you liked this article, then please subscribe to our <a href="http://youtube.com/wpbeginner?sub_confirmation=1" title="WPBeginner on YouTube"  rel="nofollow">YouTube Channel</a> for WordPress video tutorials. You can also find us on <a href="http://twitter.com/wpbeginner" title="WPBeginner on Twitter"  rel="nofollow">Twitter</a> and <a href="https://www.facebook.com/wpbeginner" title="WPBeginner on Facebook"  rel="nofollow">Facebook</a>.</p>
<p>The post <a rel="nofollow" href="http://www.wpbeginner.com/plugins/how-to-restrict-media-library-access-to-users-own-uploads-in-wordpress/">How to Restrict Media Library Access to User&#8217;s Own Uploads in WordPress</a> appeared first on <a rel="nofollow" href="http://www.wpbeginner.com/">WPBeginner</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wpwife.com/wordpress-plugins/how-to-restrict-media-library-access-to-users-own-uploads-in-wordpress/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="0" type="" />
		</item>
	</channel>
</rss>
