1

The post meta name of a post is "Klevis V. Miho". Now when searching for:

"Klevis Miho" => Nothing displays

Is it possible to show results with that search string?

Below is what I am up to now:

$args['meta_query'][] = array(
    'key'     => 'name',
    'value'   => $name,
    'compare' => 'LIKE'
);
2
  • Is the title part of some kind of post meta or is it the actual post title?
    – Howdy_McGee
    Commented Dec 4, 2014 at 15:47
  • It is a post meta Commented Dec 4, 2014 at 15:51

1 Answer 1

0

I did it this way:

$name = explode(' ', $name);
foreach($name as $string) {
    $args['meta_query'][] = array(
        'key'     => 'name',
        'value'   => $string,
        'compare' => 'LIKE' 
    );
}

Which works good, but I'm not sure if that's the best solution.

1
  • Please accept your own answer. This will get this question marked solved. :-) Commented Jun 22, 2015 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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