{"id":73758,"date":"2012-03-09T13:10:05","date_gmt":"2012-03-09T18:10:05","guid":{"rendered":"http:\/\/wpmu.org\/?p=73758"},"modified":"2012-11-20T15:24:20","modified_gmt":"2012-11-20T20:24:20","slug":"daily-tip-how-to-show-only-the-authors-posts-in-the-edit-list","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/daily-tip-how-to-show-only-the-authors-posts-in-the-edit-list\/","title":{"rendered":"How to Show Only the Author&#8217;s Posts in the Edit List"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/03\/edit.png\" alt=\"Post image\" aria-hidden=\"true\" title=\"edit\" width=\"128\" height=\"128\" class=\"alignleft size-full wp-image-73763\" \/>Every now and then users on the forums request a way to show only the author&#8217;s own posts in the &#8220;All Posts&#8221; screen. Here&#8217;s a quick snippet that you can add to your theme&#8217;s <i>functions.php<\/i> file.<\/p>\n<p>Adding this code will restrict the posts page to display only the author&#8217;s own posts, instead of posts created by all authors on the site.<\/p>\n<div style=\"clear: both; height: 5px; width: 660px;\"><\/div>\n<p>{code type=php}<br \/>\nfunction mypo_parse_query_useronly( $wp_query ) {<br \/>\n    if ( strpos( $_SERVER[ &#8216;REQUEST_URI&#8217; ], &#8216;\/wp-admin\/edit.php&#8217; ) !== false ) {<br \/>\n        if ( !current_user_can( &#8216;level_10&#8217; ) ) {<br \/>\n            global $current_user;<br \/>\n            $wp_query->set( &#8216;author&#8217;, $current_user->id );<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>add_filter(&#8216;parse_query&#8217;, &#8216;mypo_parse_query_useronly&#8217; );<br \/>\n<\/code><\/p>\n<p>This code snippet comes to you courtesy of our friends at <a href=\"http:\/\/wp-snippets.com\/only-show-the-authors-posts-in-the-edit-list\/\" target=\"_blank\">WP-Snippets<\/a>. Add it to your site if you want to keep authors from getting into each other&#8217;s posts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a quick code snippet that will restrict the posts page to display only the author&#8217;s own posts, instead of posts created by all authors on the site.<\/p>\n","protected":false},"author":4099,"featured_media":53164,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[263],"tags":[390],"tutorials_categories":[],"class_list":["post-73758","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-code"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/73758","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/4099"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=73758"}],"version-history":[{"count":0,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/73758\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/53164"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=73758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=73758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=73758"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=73758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}