Prevent search query from taking place when using Google CSE?

Same issue with you and just found it out on stackexchange. Put codes below in the function.php in your theme. function _cancel_query( $query ) { if ( !is_admin() && !is_feed() && is_search() ) { $query = false; } return $query; } add_action( ‘posts_request’, ‘_cancel_query’ ); Here’s the source

WP + Google analytics = /search?

Search code comes with wordpress.If you remove search box it does not mean that search page is removed. If you want that google should not crawl your search page then you can specify in your robot.txt file like below : Disallow: /search

Remove Page Timestamp via functions.php so it doesn’t show in Google Search Result Description [closed]

It depends on what the template uses to output whatever you’re trying to remove. If you look in source at whatever function is outputting what you want to remove, they each have a filter to let you modify output where you can __return_false instead, however, if there’s text or markup surrounding those template tags, your … Read more

adding more text to a query string

You can try and use set_query_var() very very early, before the query is parsed and queried for, for example during the pre_get_posts action. Although thinking about it, if you’re using pre_get_posts it’s likely easier to do something like this (off the top of my head): add_action( ‘pre_get_posts’, function( $query ) { if ( ! $query->is_main_query() … Read more

How to detect if the referer is 404 page?

Easiest and most robust way is to add a url parameter to the search so the search url will be something like http://www.example.com/?s=xyz&from404=1. Probably easiest way to do that is by adding a hidden field to the form. For “bonus points” use the browser’s history API to remove the parameter after the page load.

How can I add search box in single.php?

Try this and change the classes if needed. <div id=”navbar” class=”navbar”> <nav id=”site-navigation” class=”navigation main-navigation” role=”navigation”> <button class=”menu-toggle”><?php _e( ‘Menu’, ‘twentythirteen’ ); ?></button> <a class=”screen-reader-text skip-link” href=”#content” title=”<?php esc_attr_e( ‘Skip to content’, ‘twentythirteen’ ); ?>”><?php _e( ‘Skip to content’, ‘twentythirteen’ ); ?></a> <?php wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘menu_class’ => ‘nav-menu’, ‘menu_id’ => ‘primary-menu’ ) … Read more

How to have multiple instances of the same taxonomy in a search form

jpd527, Please remember that ‘tag’ is singular and not plural. Here your form has multiple HTML element with same id so this is wrong. Now if you require to search data with two different inputs, then you can merge it via JS. HTML code like: <form method=”get” id=”search form” action=”https://wordpress.stackexchange.com/”> <div> <input type=”text” value=”” name=”tag_one” … Read more