Support » Plugins » Disable search functionality

  • What would be the best way to go about disabling search from the blog?

    It’s not that I simply want to remove the search form and file, which I can do. Is there any database information specifically for search function (there used to be, I’m fairly sure, but it may not be the case any longer as I haven’t seen any at a glance)? If so, how would the code be altered so that no information would be sent to/from the database regarding search function?

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Create a pluging that empties the ‘s’ variable for URLs and forms – 3 possible places. Something like this:

    <?php
    Plugin Name: Disable Search
    Plugin URI: http://wpsecurity.net
    Description: This disables the search feature of WordPress.
    Author: Mark
    Version: 1.0
    Author URI: http://wpsecurity.net
    */
    $_GET['s']='';
    $_POST['s']='';
    $_REQUEST['s']='';
    ?>

    Copy that to a file in your plugins dir (maybe a filename like disablesearch.php), activate the plugin, and then try to do a search manually for a word you know exists in your site, then see if the search returns nothing. Example search URL:

    http://somerealsitename.com/?s=test

    You’re missing the “start comment command” in front of the second line:

    /* Plugin Name: Disable Search

    Looking through my web logs I found several search engines using the WordPress search engine to search my site. I wonder if somewhere on the web is a link to my site with the search pre-defined.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable search functionality’ is closed to new replies.