WordPress.org

Forums

Filtering custom post types and taxonomies by user (3 posts)

  1. Mario Peshev
    Member
    Posted 3 years ago #

    I've created a new custom post type and taxonomy to be used for a new user role. The new role is subscriber based but adds the capabilities of the custom post type and the new taxonomy to be able to add data.

    I want to protect the records of other users added to the same post type. So far I have added one filter for parse_query that uses the author_id as a filter. But I still have links on the top of the pages to view all records regardless the author.

    I cannot find a capability that disallows me to view foreign links. I simply want to authorize each user to be able to add records and not to be able to see other users' records. I am not sure if that is applicable for the taxonomy - if I can select only taxonomy records created by this user? But I still need to be able to filter records by taxonomy as well.

  2. Mario Peshev
    Member
    Posted 3 years ago #

    I'm still stuck with this one - also, I cannot use any external plugin such as S2Member for the user management here as this is a custom user role that has these capabilities.

    What I need to do is to limit the edit.php listing for the custom post type just like the Author listing for posts - each author is able to see only the posts that he/she has created and not to be able to access others' posts.

  3. Mario Peshev
    Member
    Posted 3 years ago #

    For the record, pre_get_posts works well enough, but views should be filtered as well - this great resource turns out to be the right one - http://blog.rutwick.com/display-only-the-posts-authored-by-the-current-wp-user-on-the-posts-page-in-the-back-end

Topic Closed

This topic has been closed to new replies.

About this Topic