[wp-trac] [WordPress Trac] #53383: bug: pre_get_posts modify vs posts (pages, etc) found numbers

WordPress Trac noreply at wordpress.org
Fri Jun 11 13:22:50 UTC 2021


#53383: bug: pre_get_posts modify vs posts (pages, etc) found numbers
-------------------------------+-----------------------------
 Reporter:  err                |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  5.7.2
 Severity:  normal             |   Keywords:  has-screenshots
  Focuses:  administration     |
-------------------------------+-----------------------------
 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
 <?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

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53383>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list