[wp-trac] [WordPress Trac] #34833: When given 'tag' as an argument into wp_query it ignores suppress_filters

WordPress Trac noreply at wordpress.org
Thu Dec 3 08:30:06 UTC 2015


#34833: When given 'tag' as an argument into wp_query it ignores suppress_filters
--------------------------+-----------------------------
 Reporter:  BenzinNZ      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  4.3.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I have the s2Member plugin installed and it is filtering out all posts on
 a page. I do not believe it to be a plugin issue as the behaviour occurs
 after the plugin filtering.

 I have my own custom plugin that is getting a list of groups and bypassing
 the s2Member plugin by adding the 'suppress_filters' to true.

 This works until I add the 'tag' argument to the argument array that is
 passed to the wp_query.

 With no arguments:

 {{{#!php
 <?php
 $args = array();
 }}}


 Logged in : Can see the list of all posts.
 Logged out : Cannot the list of posts

 With the following arguments
                 {{{#!php
 <?php
  $args = array(
         'suppress_filters' => false,
                 'tag' => 'tagExample'
         );

 }}}
 Logged in: Can see all posts in the list that match the tag 'tagExample'
 Logged out : Cannot see anything

 {{{#!php
 <?php
  $args = array(
         'suppress_filters' => true
         );
 }}}

 Logged in: Can see all posts in the list
 Logged out : Can see all posts in the list


         {{{#!php
 <?php
          $args = array(
         'suppress_filters' => true
                 'tag' => 'tagExample'
         );
 }}}

 Logged in: Can see all posts in the list that match the tag 'tagExample'
 Logged out : Cannot see anything


 The wp_query is constructed like so.
 {{{#!php
 <?php
 $postsToList= new wp_query( $args );
 }}}


 This is weird behaviour that I can't seem to isolate to the plugin, so I
 believe it might be an issue with how the wp_query constructs the query.

 The expected output is that the 'tag' argument will filter on the
 unfiltered list due to 'suppress_filters' rather than returning nothing.
 (there are definitely tags with the specified tag in the database as per
 the previous examples that work when logged in where the filters are not
 applied)

 Let me know if I can provide any more information, or if there is any way
 I can help at all diagnosing this issue!


 Cheers,

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


More information about the wp-trac mailing list