Advanced search redirecting to another page then filter further

You should use manual sql queries to fetch the records as per your customized requirement and filters rather than the query function. Otherwise install a plugin that creates advanced search form with filters. I am also sharing a reference link below which might be useful for you: http://www.wpbeginner.com/wp-tutorials/how-to-create-advanced-search-form-in-wordpress-for-custom-post-types/ If none of it helps, do mention … Read more

How to add specific phrase to end of search url

This can be done in multiple ways But the easiest will be the following code. The key is the GET method that will allow us to inject what you want. You can try: <div class=”search-box”> <div class=”container”> <div class=”columns”> <form method=”get” class=”nt-search-form” action=”<?php echo home_url(); ?>”> <input type=”text” id=”search-text” class=”input-text” name=”s” placeholder=”<?php _e(‘Search &#8230;’, ‘customsearch’);?>” … Read more

Clean Custom URL for Serach + Custom Taxonomy

With Slam’s kind tip to use query-monitor plugin, I could figure out what the problem was. Apparently the url /search/foo/filter/bar also fits the “general search” rewrite-rule. Makes sense, thinking about it– (.+) technically matches /foo/filter/bar aswell. So I could improve (.+) by excluding /s? But I found an easier solution! In hope “first match wins” … Read more

override the default WooCommerce products search form

Exists the template product-searchform.php, you have to override it in your theme. More information here about how to override WooCommerce templates from your theme. Basically the WooCommerce search forms returns only products and not also other post types because the product post type is specified in an hidden input: <input type=”hidden” name=”post_type” value=”product” />

How To Keep Search Title the same on paged Results

The problem is here: if( get_post_type()==’page’ || is_single() ){ echo ‘<h1 class=”h2″>’. $post->post_title .'</h1>’; } get_post_type() is using the global $post, which will contain the first post in your result set. If this is a page, then your other conditions will never be tested and you’ll never reach the is_search() test. Use is_page() instead: if( … Read more

Disable character’s replace in search

Try to change collation with the following code in functions.php add_filter( ‘posts_search_orderby’, ‘alter_query’, 20, 2 ); function alter_query( $orderby, $query ) { return $orderby . ‘ COLLATE latin1_general_ci’; }

How to insert Collate into WordPress search query?

You should add the following code to the functions.php of your theme (and it is better to make all modifications in child theme): add_filter( ‘posts_search’ , ‘posts_search’ ); function posts_search( $search ) { $search = str_replace( ‘LIKE’, ‘COLLATE utf8_bin LIKE’, $search ); return $search; } It works. You can check it on my test site: … Read more

Hide custom post type from search based on custom taxonomy

register_post_type() has a argument that you can set to specify which post types you want searched, thus excluded the undesired ones. This is the simplest method, just one line: ‘exclude_from_search’ = true, Alternative to that, you can hook into the search query itself via pre_get_posts and then modify the search, specifying which post types you’re … Read more

List post by title length

Add the following to your functions.php for the on save. This will create a meta value on save that stores the length of the post title. function save_crosses_title_length( $post_id ) { $title = get_the_title($post_id);//get the title $length = strlen( $title );// get the length of title if ( get_post_meta( $post_id, ‘name_length_crosses’ ) ) {//if meta … Read more