[wp-trac] [WordPress Trac] #39977: Search results for custom post type = "ANY"

WordPress Trac noreply at wordpress.org
Mon Feb 27 20:58:57 UTC 2017


#39977: Search results for custom post type = "ANY"
--------------------------+-----------------------------
 Reporter:  foxsk8        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.7.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 There is a bug for search results query for post type "ANY", any returns
 only page and post. If we use:

 {{{#!php
 <?php
 $args = array(
         's' => $s,
         'numberposts' => -1,
         'post_type' => array('post','page','gallery')
     );
 $the_query = new WP_Query( $args );
 }}}

 Then works, also pre_get_post not working.

 Debug info from QM:


 {{{
 order   DESC
 post_type       any
 posts_per_page  10
 s       Janis gallery
 search_orderby_title
 Array
 (
     [0] => wp_8b3200f070_posts.post_title LIKE '%Janis%'
     [1] => wp_8b3200f070_posts.post_title LIKE '%gallery%'
 )
 search_terms
 Array
 (
     [0] => Janis
     [1] => gallery
 )
 }}}

 If we use standart:


 {{{
 <?php if (have_posts()) : while (have_posts()) : the_post();?>
 }}}

 Then custom post types is not showed on search results.

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


More information about the wp-trac mailing list