title: How to create/modfiy WP_Query to search in post title OR custom field?
body: <p>I need to modify or create a <code>WP_Query</code> that will search for a search term in both the post title OR a custom field (called 'my_field').</p>
  
  <p>I have been reading and trying for hours, but I am right back to this code (below) which, alas, only searches in 'my_field' and does not take the <code>post_title</code> into account.</p>
  
  <pre><code>function my_pre_get_posts_2( $query ) {
   if ( is_admin() &amp;&amp; $query-&gt;is_main_query() &amp;&amp; $query-&gt;query['post_type'] === 'post' &amp;&amp; isset($query-&gt;query['s']) ) {
  
      $search_word = $query-&gt;query['s'];
  
      $args = array(
          //'s' =&gt; $search_word, //If I include this line, the WP query seems to AND post_title and my_field. If I comment out this line, the WP query only searches in my_field. (I need WP to OR post_title and my_field.)
          'post_type' =&gt; 'post',
          'meta_query' =&gt; array(
              'relation' =&gt; 'OR',
              array(
                  'key' =&gt; 'my_field',
                  'value' =&gt; $search_word,
                  'compare' =&gt; 'IN'
              ),
              array(
                  'key' =&gt; 'post_title',
                  'value' =&gt; $search_word,
                  'compare' =&gt; 'IN',
              )
          )
      );
  
      //$query = new WP_Query( $args ); //Need to modify the existing WP_Query
      $query-&gt;init();
      $query-&gt;parse_query($args);
   }
  }
  add_action( 'pre_get_posts', 'my_pre_get_posts_2' );
  </code></pre>
  
  <p>The reason I need to do this is because I need to modify the behaviour of the the 'Search Posts' button in the 'All Posts' (admin) page so that whatever the admin user searches for, it will return the posts that have a matching post title OR my_field value.</p>