[wp-trac] [WordPress Trac] #29850: Theme Function Filter disables Admin Dashboard Post Filter

WordPress Trac noreply at wordpress.org
Fri Oct 3 12:02:33 UTC 2014


#29850: Theme Function Filter disables Admin Dashboard Post Filter
--------------------------+-----------------------------
 Reporter:  antonv        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.9.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I have following filter in my theme functions.php to exclude post from an
 Archive Widget:

 {{{
 function exclude_category($query) {
 if ( $query->is_archive ) {
 $query->set('cat', '-26,-1,-57,-58');
 }
 return $query;
 }
 add_filter('pre_get_posts', 'exclude_category');
 }}}

 However, this disables the filter by category on the Posts-page (../wp-
 admin/edit.php). Removing above code from theme functions.php the Post-
 page filter works as it is intended to do. This is new as the Posts-page
 filter used to work on an earlier version of WP with above code in the
 theme functions.php.

 Surely theme filters should not take precedence over the wp-admin pages.

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


More information about the wp-trac mailing list