Wp query search built out of 4 terms?


I’m wondering if the following is possible.
I’m building a database of exams for different languages in different difficulty levels and there are different types as well.


function universitySearchResults3($data) {
  $mainQuery = new WP_Query(array(
    'post_type' => array('gyakorlofeladat'),
    's' => sanitize_text_field($data['term'])

There is a form on the website which has dropdowns for each, and they get queried. The issue is, that the query builds up so that this only works in case the FULL query is in the title of the post. Which is not how I want to set it up.

I have ACF fields with each of these, and the SEARCH EVERYTHING plugin taking care of pulling these in to the search (WP does not search ACF fields without it

So my question is, is it possible to have the search function as follows:

1.Search for $language in title and acf fields,
2.Search for $level in title and acf fields,
3.Search for $level in title in acf fields,

DO NOT concatenate search, but treat them as separate searches and match result if all three show the same post as result.

Is this possible? Thanks in advance!

Pbalazs89 4 weeks 2023-05-06T03:39:57-05:00 0 Answers 0 views 0

Leave an answer