<?php
/*
Plugin Name: Simplify Post Edit List
Description: Show only the author's posts in the edit list
Version: 0.1
License: GPL
Author: Sarah Gooding
*/
function mypo_parse_query_useronly( $wp_query ) {
if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) {
if ( !current_user_can( 'update_core' ) ) {
global $current_user;
$wp_query->set( 'author', $current_user->id );
}
}
}
add_filter('parse_query', 'mypo_parse_query_useronly' );
// Remove Post Counts
// Create a specific hook
add_filter('views_edit-post', 'custom_editor_counts', 10, 1);
function custom_editor_counts($views) {
// var_dump($views) to check other array elements that you can hide.
unset($views['all']);
unset($views['publish']);
unset($views['pending']);
unset($views['trash']);
return $views;
}
?>
WHAT'S NEW?
Loading...
[PLUGIN] Change the Wordpress posts page to show only the author’s own posts
The code below checks to see if a user has admin capabilities. If the user is not an admin, he will only see his own posts listed on the posts edit screen, making it easier for him to locate his own posts.
0 comments:
Post a Comment