Support » Fixing WordPress » Only show suthors their custom post types in dashboard.

  • I have created a custom post type and would like to limit the authors of that custom post type to only see the posts they have created, as opposed to showing them custom posts created by other users as well as their own.
    I have tried customizing the solution found here for custom posts, by editing ‘edit.php’ to ‘edit.php?post_type=MY CUSTOM POST TYPE’, an putting in in my function.php , but that did not work. I’m sure someone has figured this out.
    Thank you in advance.

Viewing 9 replies - 1 through 9 (of 9 total)
  • I use this css mod in functions.php to mod the admin posts filter to only show the current user’s posts.

    function posts_filter() {
        echo '<style type="text/css"> 
    /*admin all-posts screen*/
    /*ul.subsubsub .mine,*/
    ul.subsubsub .all,
    ul.subsubsub .publish,
    ul.subsubsub .sticky,
    ul.subsubsub .trash,
    ul.subsubsub .draft,
    ul.subsubsub .pending,
    .tablenav ,
    .row-actions .editinline,
    * {display:none;}
    add_action('admin_head', 'posts_filter');

    not sure if it works with custom taxonmies and post types..

    Thank you, but that did not seem to work, not sure it is for posts, but its not working for custom post types. Thank you so much for responding anyway, any other ideas?

    if you use a web page inspector tool like firebug you could probably find the correct css then just add the selectors between
    function posts_filter() {
        echo '<style type="text/css"> 
    your css code here
    * {display:none;}
    add_action('admin_head', 'posts_filter');

    anyway here’s screen shot of what I posted working on my site

    You could also go at it another way, use the Adminimize plugin to remove access to the posts link in the admin menu. Then just allow users access posts for editing via the front-end post edit link.

    but, the one problem with that is when users delete posts they will be redirected to the admin posts filter page…

    but you could possibly fix that this way:

    function my_trashed_post_handler($post_id)
        wp_redirect( get_option('siteurl') );

    I really appreciate your help, I do have firebug, and it was motivation to see the screenshot, thanks for the effort, I owe you either way!…
    here is my screen shot this is front he admin view, but i just realized , its not even showing the author in that list. Still no luck on this, have you ever used custom posts?

    yes, I’ve used custom posts and taxonomies. But I don’t recall that It made any difference in the admin post list.

    or better said, I would expect that the same css selectors would work for custom post types.

    How did you acheive your setup in the screenshot? it appears as though you have what you were going for,
    and are those both the same author’s posts? is that not the goal? sorry if I’m missing something..

    my method is really not so fancy, all it does is remove the admin post list sorting capability for the author role, leaving “mine” as the only sorting option. But it worked for me.

    I was using this solution before (see example 4, it’s for posts and media), but I had strange issues with it when used with other roles and capabilities plugins.

    still, you might try it with your custom post type defined in this part of the code

    foreach( $types as $type ) {
            $query = array(
                'author'      => $current_user->ID,
                'post_type'   => 'post',
                'post_status' => $type['status']

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Only show suthors their custom post types in dashboard.’ is closed to new replies.