Having trouble with WP_Query using OR statement

I’m trying to write an query that should find a post by search-term or tag-name. But when i add the tag name the search stops working.

$mainQuery = new WP_Query(array(
    'post_type' => array('coworker', 'post', 'page', 'news'),
    's' => sanitize_text_field($data['term']),
    'relation' => 'OR',
    'tag' => array(
        'tag' => sanitize_text_field($data['term'])

What have i done wrong here?

  • This topic was modified 4 days, 7 hours ago by cookie11.

Source link