Assuming I have these custom post types:
And for Product (WooCommerce Product), we have many Categories, one of which is called "Parts".
I have this situation where I need to sort my search query using the following rule:
- Product (that is not Parts), then
- Product (Parts), then
- Video, then
That means if I search a keyword, say "engine", Products should come out first (with main products coming out before parts). Then Video and Article should come later.
Is it possible to capture such a use case?
I've solved the issue with "Sort By Post Type", referring to this post: Sort search results by post type
What puzzles me is, how can we sort by Post Type and then by Taxonomy, but only in the case if the post_type is Product.