Opened 4 years ago
#53383 new defect (bug)
bug: pre_get_posts modify vs posts (pages, etc) found numbers
Reported by: | err | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.7.2 |
Component: | Posts, Post Types | Keywords: | has-screenshots |
Focuses: | administration | Cc: |
Description
Dear WP!
I'm pretty sure I've just found a bug. I want to hide certain posts, pages, media elements and custom post type posts from users. These posts are filtered by their IDs with a pre_get_posts action. The filter itself works well, but the displayed found numbers (on the top of the page) are invalid. On the bottom it's ok again.
<?php function mod_func($query) { if (is_admin()) { if (($pagenow == 'edit.php') && (get_query_var('post_type') == 'page')) {\ $query->set('post__not_in', array(5800)); } } } add_action('pre_get_posts', 'mod_func', 999);
Screenshot:
https://webgeek.hu/wp-bug-post-counter.jpg
Hope you can understand me, I'm not the best in English.
If you have questions, feel free to ask me.
Thanks for helping in advance (and thanks for working hard for years),
Sincerely,
Somogyi Balázs
Attachments (1)
Note: See
TracTickets for help on using
tickets.
wp post counter bug