Search result permalink

That kind of search request should already work(query it directly in your address bar), the component you’re missing is redirecting the non-pretty search requests.. For doing the redirect, you should find the following plugin still works.. http://txfx.net/wordpress-plugins/nice-search/ Hope that helps..

Refine Search Results

Search is a big topic and therefore I can only guess the direction you want to go to. Like @MikeSchinkel in his comment was asking for more, I can for the moment only provide a list of links of which one might come close to what you need: Refine search by category (How-To); Building a … Read more

Search form with Category and Sub Category

First you have to give your dropdown names so: <?php $media = array( ‘name’ => ‘subcat’, ‘hierarchical’ => 1, ‘parent’ => get_cat_id(‘Media’), ‘show_option_none’ => (‘All Media’), ‘hide_empty’ => 0 ); ?> <form method=”get” id=”searchform” action=”<?php bloginfo(‘url’); ?>/”> <div> <input type=”text” value=”<?php the_search_query(); ?>” name=”s” id=”s” /> <?php wp_dropdown_categories(‘name=maincat&show_option_none=All Category’); ?> <?php wp_dropdown_categories($media); ?> <input type=”hidden” … Read more

Do not allow to search certain words

Try this in your functions.php, and change news for whatever you want to be blocked in your site. add_action(‘wp’, ‘check_search’); function check_search() { global $wp_query; if (!$s = get_search_query()) return false; if (preg_match(‘/news/’, $s)) { $wp_query->set_404(); status_header(404); get_template_part(404); exit(); } } Hope it helps.

Creating a Front-end based User Search

As you haven’t offered the details on what you’re after, I’ll try to grab them all very briefly. Use the API – public WP_User_Query API functions Basically get_user_by() should be enough for you. Let’s say you fire of your form and the input field name was user_id. So you’d just retrieve the value from the … Read more

Which template holds what to display when search returns nothing

get_template_part( ‘content’, ‘none’ ); will look for: content-none.php content.php Twenty Thirteen does have content-none.php. In general this is organized in such way to support dynamic lookups where first two-part template might or might not exist and fallback to more generic template, if necessary.

Search tags in CPTs

This would only work if the keyword exactly matches the tag that you are searching for, and unfortunately, tag data isn’t indexed by WordPress search by default, so that won’t yield anything either. If you want to index the tags and include that in search results you might want to use a plugin. Relevanassi might … Read more

Filtering search results

You may need to include a tax_query for the Woocommerce taxonomy (called ‘product_cat’): $tax_query = array( array( ‘taxonomy’ => ‘product_cat’ ), ); $query->set( ‘tax_query’, $tax_query ); } return $query; } However, you’ll have to ensure that you can return posts AND pages AND product categories and also note the search results will be mixed up … Read more

How do I make search results include ONLY pages, no posts?

You can enforce a post type per callback on pre_get_posts: is_admin() || add_action( ‘pre_get_posts’, function( \WP_Query $query ) { $post_type = filter_input( INPUT_GET, ‘post_type’, FILTER_SANITIZE_STRING ); if ( $post_type && $query->is_main_query() && $query->is_search() ) $query->set( ‘post_type’, [ $post_type ] ); }); If that still includes other post types, you have a second callback registered on … Read more