Disabling WP Search Feature
-
I have WP version 6.1.1 with Astra theme version 3.9.4 installed. I have disabled directory and file listing via my security plugin to inhibit unwanted visitors from searching files and folders. When an unwanted visitor searches for a file/folder they received the WP search page that states “It looks like the link point here is faulty. Maybe try searching?” with the “search box”.
I have found a couple of recommendations including one plugin, most of which all do the same thing by removing the actual search box from the page. I ended up using code from https://www.hostpapa.com/knowledgebase/disable-search-feature-wordpress (which was identical to several other recommendations) that I have added to the functions.php file. The added code removes the “search box” from the page however I really would prefer the redirect go to an actual “404 Page Not found” message when an unwanted visitor is attempting to tour the website’s files/folders. All of the recommendations indicate that the code will redirect queries to a 404 page, but the actual 404 page is not displayed, only the search box is removed.
Any guidance assistance is appreciated.
- The topic ‘Disabling WP Search Feature’ is closed to new replies.