can’t limit search to only pages

A quick test on a default install with TwentyEleven confirms this, and I’m not sure why this is the case, however there is a way you can do this via your functions.php. add a hidden field to the form with your own query var: <input type=”hidden” name=”my_type” value=”page” /> or: <input type=”hidden” name=”my_type” value=”post,page” /> … Read more

Filter results with custom field values and dropdown

Edited according to first comments and Pastebin code: <?php /* You can also leave ‘action’ blank: action=”” */ ?> <form method=”post” action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>”> <select name=”my_size” id=”size” class=”postform” onchange=”submit();”> <option selected=”selected”>Choose a size</option> <option value=”10″>10</option> <option value=”20″>20</option> </select> </form> <?php /* Reset filter */ ?> <p><a href=”https://wordpress.stackexchange.com/questions/83928/<?php the_permalink(); ?>”>Clear filter</a></p> <?php if( !isset($_POST[‘my_size’]) || … Read more

Create product category and keyword search form in woocommerce? [closed]

I just made it for a client, you’ll have to do it on the pre_get_posts action. That means you will add parameters to the WordPress query before it returns the posts. Add this to functions.php: // advanced search functionality function advanced_search_query($query) { if($query->is_search()) { // category terms search. if (isset($_GET[‘category’]) && !empty($_GET[‘category’])) { $query->set(‘tax_query’, array(array( … Read more

Modifying widget search box

The default Search widget uses the get_search_form() core function to display the search form. You can therefore edit the search form’s action <form role=”search” method=”get” class=”search-form” action=”http://domain2.com”> in the child theme’s searchform.php file. Here we assume domain2.com also supports the default WordPress search parameters. If we don’t want to modify the file, we can adjust … Read more

Exclude a term of a taxonomy with a custom post type in a search

The problem with your approach is that woocommerces product category is a custom taxonomy called product_cat. But with cat you are addressing the built-in category. Taxonomies can be addressed with a tax query, simplified example below: function wpse188669_pre_get_posts( $query ) { if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) { $query->set( ‘post_type’, array( ‘product’ … Read more

Turning Broken URLs Into Search Terms?

You can try a plugin to do this: http://wordpress.org/extend/plugins/smart-404/ Reads the page URL and tries to find a page/post that it might match and redirect to it. Found out about this plugin from: http://www.aebeta.com/web-hosting/seo/7-seo-friendly-404-plugin-for-wordpress.html

Exclude from search all custom posts which are NOT in a taxonomy term

After reading your revised question it was easier to comprehend what you are trying to do. My new solution looks like the thing you wanted to do in the first place: it just excludes all posts which are of your custom type but don’t have the “yes”-term associated with it: $custom_query = array(); $custom_query[‘post_type’] = … Read more

Modify search function in WordPress (TwentyTwelve)

Modify the searchform.php, or create one in a child theme (recommended), and you should be able to modify the form all you want. This is the file that get_search_form looks for and is the file used by the default search widget, though it is not listed in the Template Hierarchy. Reference: http://codex.wordpress.org/Function_Reference/get_search_form