Opened 9 years ago
Last modified 7 years ago
#39977 new defect (bug)
Search results for custom post type = "ANY"
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | 4.7.2 |
| Component: | General | Keywords: | |
| Focuses: | Cc: |
Description
There is a bug for search results query for post type "ANY", any returns only page and post. If we use:
<?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.
Note: See
TracTickets for help on using
tickets.
Looking at inline documentation it looks like
anyis only supported when using a tax query or search.