I have created a custom post type (CPT) in WordPress that I’ve made available to logged in users that have a new custom role.
When such a user logs into wp-admin they are shown the list of CPTs – at https://example.org/wp-admin/edit.php?post_type=my_cpt – in the usual way.
So, on that page, they can select whether to filter the CPT list by "All", "Mine", "Published", "Pending" and "Bin".
What I would like is so that they only see their own CPT posts and not anyone elses. How can I achieve this without using a CSS hack?
2
Answers
@Codeschreiber.de (or anyone else), is this how the
$pagenow
global should be used, if at all??this function make it happen:
add a filter to the admin query, which always set the author to current user.