Site icon Hip-Hop Website Design and Development

Search not working with title and content material

I’m engaged on search. I’m able to search submit by tag and class however not in a position to search by title and content material.

I attempted under code nevertheless it’s not working. Would you assist me out?

$getSearch = get_search_query();
//print($search);
$question = new WP_Query([
  'post_type' => 'post',
  'tax_query' => array(
    'relation' => 'OR',
       array(
      's'=> $getSearch // for title and content
    ),
    array(
      'taxonomy' => 'post_tag', //for tag
      'field' => 'slug',
      'terms' => array($getSearch),
    ),
    array(
      'taxonomy' => 'category', // for category
      'field' => 'slug',
      'terms' => array($getSearch),
    ),
  ),
]); 

if ($query->have_posts() ):
      whereas ( $query->have_posts() ) {$query->the_post();?>
<!--some content-->
<?php }
else :
       get_template_part( 'template-parts/content material', 'none' );
        endif;
?>

?>

operate.php

add_action( 'pre_get_posts', 'my_search_exclude' );
operate my_search_exclude( $question ) {
  if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
    $query->set( 'post_type', array( 'submit', 'web page', 'product' ) );
    $query->set( 'post__not_in', array( 471 ) );
     $taxquery=  array(
  'post_type' => 'any',
  's'=> $query->get('s')
);
$query->set( 'tax_query', $taxquery);

  }
}