0

I was hoping to make changes in the search.php file, where I want to display search results from Post, Products and Custom Taxonomy on the same page in three different section. Can anybody help me to achieve this?

Thanks, S

1
  • search.php doesn't perform a search, it just displays the results. The search is done long before search.php is loaded – Tom J Nowell Apr 20 at 11:42
1

I believe you cannot achieve it in the same loop. Instead, you should have three loops, each setting WP_Query criteria differently (setting WP_Query arguments to filter for Post, Products and Custom Taxonomy). Howevery, you want to save initial search parameters in variable(s), so you could apply them to those three different loops as other parts of arguments array. More details you can find in lower part of this page: https://wordpress.org/support/article/creating-a-search-page/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.