[wp-trac] [WordPress Trac] #40387: WP_Query bug with product post type with search parameter on

WordPress Trac noreply at wordpress.org
Mon Apr 10 19:30:20 UTC 2017


#40387: WP_Query bug with product post type with search parameter on
------------------------------+-----------------------
 Reporter:  subrataemfluence  |       Owner:
     Type:  defect (bug)      |      Status:  reopened
 Priority:  normal            |   Milestone:
Component:  Query             |     Version:  4.7.3
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:
------------------------------+-----------------------

Comment (by boonebgorges):

 > It's possible the exclude_from_search parameter is set to true on the
 product post type.

 A good thought - but (a) WooCommerce doesn't set `exclude_from_search` to
 `true`, and (b) even when `exclude_from_search=true`, `WP_Query` by itself
 doesn't change post types based on `exclude_from_search`. (Primary
 `exclude_from_search` filtering happens in `WP::parse_request()`.)

 @subrataemfluence I've installed WooCommerce, created some items, and
 tested the precise code that you've provided, but I was not able to
 reproduce. The `request` SQL string, in both cases, contains
 `wp_posts.post_type = 'product'`.

 I don't have any clear ideas about what might be happening.
 @subrataemfluence Are you able to dig deeper into `WP_Query` to see where
 `post_type` is getting reset?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40387#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list