title: Ignore string in SQL query?
body: <p>I've been using the function below to list products within an A to Z directory on a WordPress/WooCommerce site. E.g. visiting <code>site.com/a-to-z/?letter=a</code> would show a catalogue of products beginning with A.</p>
  <pre><code>function wpse_298888_posts_where( $where, $query ) {
      global $wpdb;
  
      $starts_with = $query-&gt;get( 'starts_with' );
  
      if ( $starts_with ) {
        $where .= &quot; AND $wpdb-&gt;posts.post_title LIKE '$starts_with%'&quot;;
      }
  
      return $where;
  }
  add_filter( 'posts_where', 'wpse_298888_posts_where', 10, 2 );
  </code></pre>
  <p>This has been working great, but the client has now changed the way that they're naming their products, so a majority of them are now prefixed with phrases like &quot;Char Grilled&quot; or &quot;Pan Fried&quot; etc. For example &quot;Steak&quot; has now become &quot;Char Grilled Steak&quot;. This means that the function above isn't really working as we want it to any more, so is there any way to alter the SQL query so that it will ignore a predefined set of phrases like &quot;Char Grilled&quot;, &quot;Pan Fried&quot; and so on?</p>