• 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator t-p

    (@t-p)

    Since you use athird-party code and need support, please go to their official support channel so you can get support from the people who know it best.

    Thread Starter suncountryiris

    (@suncountryiris)

    Thank you for your response.

    I may not have been clear in my description, all of the codes and plugins have the same result, they remove the search box but leave the remainder of the search page intact. If I understand correctly, the WP Search Feature is a function of WP. So I am searching for an resolution of what code will work in WP that will display the “404 file not found” page, perhaps someone in the WP world may have the correct answer.

    Moderator t-p

    (@t-p)

    all of the codes and plugins have the same result, they remove the search box but leave the remainder of the search page intact.

    For plugins, I recommend asking in that plugin’s support forum how remove remainder of the search page.

    Similarly, for any of the codes, I recommend asking the writer of that code how remove remainder of the search page.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disabling WP Search Feature’ is closed to new replies.