Skip to content

Instantly share code, notes, and snippets.

@orfeomorello
Last active February 1, 2017 06:15
Show Gist options
  • Save orfeomorello/4bb6f9c1fcb7144089cebda3fdbe9db4 to your computer and use it in GitHub Desktop.
Save orfeomorello/4bb6f9c1fcb7144089cebda3fdbe9db4 to your computer and use it in GitHub Desktop.
<?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;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment