How To Disable WordPress Search

How To Disable WordPress Search? I got the answer from WPEngineer.com, This nice tips is will disable WordPress Search more easy and of course easy to do. Why disable WordPress search? Here some of my reason. Some time WordPress based application didn’t need this featured.

disable-wordpress-search

Here we go, If you set the variable $error to true, then you will be fowarded to the error page of the theme, if not, then you will remain on the page from where the search was started.

[sourcecode language=’php’]
function fb_filter_query( $query, $error = true ) {

if ( is_search() ) {
$query->is_search = false;
$query->query_vars[s] = false;
$query->query[s] = false;

// to error
if ( $error == true )
$query->is_404 = true;
}
}

add_action( ‘parse_query’, ‘fb_filter_query’ );
add_filter( ‘get_search_form’, create_function( ‘$a’, “return null;” ) );
[/sourcecode]

This is some tips that I got and you can read more details on this post.

0

15 Comments

  1. halo mas jauhari.salam kenal dari saya.
    tau caranya menngeser menu page yang ada di wordpress ga ya? cos punyaku kok jadi numpuk sama serach bar ya..?
    thx mas..

  2. […] How To Disable WordPress Search JAUHARI Posted by root 5 minutes ago (http://www.jauhari.net) Why disable wordpress search here some of my reason 6 comments add yours the upper is the most recent comment get dedicated servers middot make money online express furniture the largest retailer of contemporary furniture powered by wordpress 2 7 1 entrie Discuss  |  Bury |  News | How To Disable WordPress Search JAUHARI […]

  3. […] How To Disable WordPress Search JAUHARI Posted by root 28 minutes ago (http://www.jauhari.net) Why disable wordpress search here some of my reason 6 comments add yours the upper is the most recent comment get dedicated servers middot make money online express furniture the largest retailer of contemporary furniture powered by wordpress 2 7 1 entrie Discuss  |  Bury |  News | How To Disable WordPress Search JAUHARI […]

  4. […] How To Disable WordPress Search JAUHARI Posted by root 1 hour 26 minutes ago (http://www.jauhari.net) Why disable wordpress search here some of my reason 6 comments add yours the upper is the most recent comment get dedicated servers middot make money online express furniture the largest retailer of contemporary furniture powered by wordpress 2 7 1 entrie Discuss  |  Bury |  News | How To Disable WordPress Search JAUHARI […]

  5. […] How To Disable WordPress Search JAUHARI Posted by root 1 hour 57 minutes ago (http://www.jauhari.net) Why disable wordpress search here some of my reason 6 comments add yours the upper is the most recent comment get dedicated servers middot make money online express furniture the largest retailer of contemporary furniture powered by wordpress 2 7 1 entrie Discuss  |  Bury |  News | How To Disable WordPress Search JAUHARI […]

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan.

Situs ini menggunakan Akismet untuk mengurangi spam. Pelajari bagaimana data komentar Anda diproses.