I wanted to change what posts were displayed to a user when they logged into wordpress and view the Posts page I could easily alter what posts are shown by using the ‘pre_get_posts’ filter, but the problem was that the number of posts for each status did not change. You know, at the top of the page it looks like: “All (5) | Published (5)”. The number 5 did not reflect the number of posts being shown.
I was hoping to find a filter of some sort on the wp_count_posts function, but there are none. The second best solution is to rewrite that whole line using the ‘views_edit-post’ filter where “edit-post” is the page id. A sample of what can be done is in the link below.
keywords: wp_count_posts filter