mercredi 1 août 2018

Wordpress wont return search results with apostrophe in its title

Im working on a Wordpress site that is using the native WP search functionality to search through the titles of posts in a specific post type. When i search, for example, 'Mcdonalds', no search results are shown. However, If i search for 'Mcdonald's' with an apostrophe, it will return the post titled "Mcdonald's" - Is there any way to make the Wordpress native search more "lax" on grammatical characters such as apostrophes, etc?

Heres the markup for my search bar which is placing the ?s= URL parameter:

<form class="search" id = "tenant-search-wrap"method="get" action="<?php echo 
home_url(); ?>" role="search">
<div class = "tenant-form-cont"><input type="text" placeholder = "Search By 
Tenant" value="<?php echo ((isset($_GET['s'])) ? htmlspecialchars($_GET['s']) : 
''); ?>" name="s" id="s" class = "search-field" />
<input type="submit" id="searchsubmit" value="Search" class = "search-submit"/>
<input type="hidden" value="tenants" name="post_type" id="post_type" />
</div>
<a class = "view-tenant-anchor" href="/tenants"><p>View Entire Tenant List</p> 
</a>
</form>

Any help/guide in the right direction is appreciated. Thank you!




Aucun commentaire:

Enregistrer un commentaire