Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
Coppa WPB
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Come disattivare la funzione di ricerca in WordPress (semplice e facile)

Nota editoriale: guadagniamo una commissione dai link dei partner su WPBeginner. Le commissioni non influenzano le opinioni o le valutazioni dei nostri redattori. Per saperne di più su Processo editoriale.

Volete disabilitare la funzione di ricerca in WordPress?

A volte, il vostro sito potrebbe non avere bisogno della funzione di ricerca o il modulo di ricerca nel vostro tema potrebbe interferire con l’esperienza dell’utente.

In questo articolo vi mostreremo come disabilitare facilmente la funzione di ricerca in WordPress.

How to disable the search feature in WordPress

Perché e chi dovrebbe disabilitare la funzione di ricerca in WordPress?

I siti web WordPress sono dotati di una funzione di ricerca che consente ai visitatori di cercare i contenuti all’interno del sito.

Molti siti web WordPress sono semplici siti aziendali con poche pagine. È in crescita anche la tendenza a creare siti web di una sola pagina con navigazione verticale.

Questi siti web non hanno molti contenuti, il che rende inutile il modulo di ricerca. Inoltre, gli utenti hanno l’impressione che ci siano altre informazioni che non vedono e che possono trovare attraverso una ricerca.

Eliminando la funzione di ricerca, il vostro sito sarà più pulito e offrirà una migliore esperienza all’utente.

Detto questo, vediamo come rimuovere facilmente la funzione di ricerca dal vostro sito WordPress:

Metodo 1. Rimuovere la funzione di ricerca in WordPress utilizzando un plugin

Questo metodo è semplice e diretto.

Per prima cosa, è necessario installare e attivare il plugin Disable Search. Per maggiori dettagli, consultate la nostra guida passo passo su come installare un plugin di WordPress.

Disable search plugin

Dopo l’attivazione, il plugin funziona immediatamente. Non ci sono impostazioni da configurare.

Rimuove i moduli di ricerca dal tema WordPress e disabilita il widget di ricerca. Se un utente tenta di inserire direttamente un URL di ricerca, il plugin restituisce una pagina di errore 404.

404 page not found example

Si noti che questo plugin non influisce sulla funzionalità di ricerca all’interno dell’area di amministrazione di WordPress. È ancora possibile cercare post e pagine all’interno della dashboard di WordPress.

Metodo 2. Disattivare la ricerca in WordPress con il codice

Questo metodo richiede l’aggiunta di codice ai file del core di WordPress del vostro sito. Se non l’avete mai fatto prima, date un’occhiata alla nostra guida su come aggiungere snippet di codice in WordPress.

Normalmente, non consigliamo di modificare direttamente i file di WordPress, in quanto anche piccole modifiche possono danneggiare il sito. Tuttavia, useremo WPCode, che è il modo più sicuro e semplice per aggiungere codice al vostro sito WordPress.

Per prima cosa, è necessario installare il plugin gratuito WPCode. Per maggiori dettagli, consultate la nostra guida passo-passo su come installare un plugin di WordPress.

Dopo l’attivazione, è necessario trovare Code Snippets “ Add Snippet nella dashboard di amministrazione.

A questo punto, è sufficiente digitare “disable search” nel campo e cliccare su “Use snippet”.

Search in WPCode for disable search

Verrà visualizzata una schermata in cui tutte le impostazioni per l’esecuzione di questo frammento di codice sono già state configurate.

È sufficiente spostare l’interruttore su “Attivo” e fare clic su “Aggiorna”.

Click the Activate toggle and press Update to disable search in WordPress

Questo codice non solo impedisce le query di ricerca, ma rimuove anche i moduli di ricerca, il blocco di ricerca dall’editor di contenuti e la casella di ricerca del menu della barra di amministrazione.

Gli utenti che hanno accesso alla dashboard di amministrazione del sito, tuttavia, saranno ancora in grado di cercare tra i post, le pagine e i commenti da lì.

A before and after image for wpcode removing search feature

Bonus: Disabilitare le funzioni del blog in WordPress

Oltre alla barra di ricerca, potreste anche voler disabilitare le funzioni del blog in WordPress. Se avete un semplice sito web a una pagina, non avrete bisogno di mostrare un blog.

Ad esempio, molti negozi online, siti di portfolio online o siti di membership potrebbero non avere bisogno di un blog. Anche se potete costruire il vostro sito WordPress senza utilizzare le funzioni di blogging, queste rimarranno comunque visibili nell’area di amministrazione.

È sufficiente scaricare il plugin Disable Blog, che nasconderà il tipo di post insieme a tutte le impostazioni relative al blog e alle pagine di amministrazione.

Dopo l’attivazione, il blog rimuove automaticamente le impostazioni “Post” dal menu a sinistra della barra laterale dell’amministrazione. Per maggiori dettagli, consultate il nostro tutorial su come disattivare facilmente le funzioni del blog in WordPress.

disable blog example

Speriamo che questo articolo vi abbia aiutato a capire come disabilitare facilmente la funzione di ricerca in WordPress. Potreste anche voler consultare il nostro elenco degli errori più comuni di WordPress e di come risolverli o i migliori plugin di moduli di contatto per WordPress.

Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per le esercitazioni video su WordPress. Potete trovarci anche su Twitter e Facebook.

Divulgazione: I nostri contenuti sono sostenuti dai lettori. Ciò significa che se cliccate su alcuni dei nostri link, potremmo guadagnare una commissione. Vedi come WPBeginner è finanziato , perché è importante e come puoi sostenerci. Ecco il nostro processo editoriale .

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Il kit di strumenti WordPress definitivo

Ottenete l'accesso gratuito al nostro kit di strumenti - una raccolta di prodotti e risorse relative a WordPress che ogni professionista dovrebbe avere!

Reader Interactions

22 commentiLascia una risposta

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Steven says

    Line 11 of method 2 was not hiding the search form for my installation, but makes the default form appear, which is loaded / generated by general-template.php’s function get_search_form (at least WordPress 5.4.2).

    The function applies the filter get_search_form. In case the filter returns null (null === $result, line 299), the previously loaded or generated default form will be shown or returned.

    To hide the form, I had to change line 11 needs to return an empty string:

    add_filter(‘get_search_form’, function ($a) { return ”; });

  3. lee maupa says

    i have the same problem in that im failing to access the customization nav and iv tried to make changes in the code but not getting any joy. i have tried to install the plugin but still the search still appears. please some one help how to resolve this issue.
    which folder/file do i get the header menus maybe i can remove it from there, please assist

    • WPBeginner Support says

      That can vary from theme to theme where the file is after you to into your wp-content/themes/theme name file. Some themes have a header.php while others have the code in another location. If you reach out to your theme’s support they should be able to assist.

      Admin

  4. Sherell says

    Thank you for posting this! I was filling my site with all kinds of crazy codes I was finding on the internet in hope of getting rid of that doggone search box! Now everything is good!

  5. Jeff Cohan says

    Thanks for this. Very useful.

    A few comments:

    1. Method 2 (manual) works for me (i.e., removing search box) on a child theme of twentyeleven, but only for a search *widget* added to a widget area. It leaves the search box that is hard-coded (using get_search_form()) into header.php. I know I can override the parent theme’s header.php by cloning/editing it, but I’l like to know how to disable that search form programatically.

    2. I cannot get Method 2 to work on a Genesis theme. I wonder if you or anyone has some insights here.

    3. A little thing: the method 2 script needs a closing brace on line 14.

  6. Toddp says

    Ok it removed the search box but left the search title that we must now figure out how to remove.
    DO you have an plugin for that?
    Seems to me you would have an option like this already installed in the site builder.

  7. Samantha says

    Sometimes you can disable the search feature for example, on an one page site that does not really need a search feature.

  8. Tati says

    Thanks for the article. What I need to know is: can I disable only some terms of the search and keep the search function working? I want to exclude things like /?s=d, download, thank, success, congratultions… terms that hackers use to find specific pages inside our sites.

    Can someone help me with this? TIA

  9. Silvana Donato says

    Thank you very much.
    I have just been hacked in the database of one of my websites and I have removed all the possible gates to these terrible annoying people, who have nothing to do in life but distroying other people work.
    So I removed the search forms but i did not know how to remove the query string.

  10. Gary C says

    Another reason for disabling the search box that comes with WordPress is to replace with a different search box, such as Google Custom Search.

    Google Custom Search allows you to monetize your search pages provides you have an Adsense account.

  11. Steven Bradley says

    I’m having a hard time understanding the usefulness of this code. If search is unnecessary wouldn’t it make more sense to not include the search form? If you leave a search form on a page and then don’t let someone use that search form isn’t that very poor usability?

    Am I missing something?

    • Editorial Staff says

      You can remove the search form in the design, but the functionality stays. Anyone who knows it is WordPress can simply add a /?s=keyword and search the site. But by removing the form and adding this code will take care of that problem. There will be time when you have a client that only wants pages or posts to be shown if the URL is available. This function will come handy in that sense.

      Admin

    • Toddp says

      Yes it makes more sense to leave out search and other widgets and allow the customer to add them if they want them and not put them by default.

  12. Marc T says

    Hmmmm…. can’t imaging Search not being important for a CMS. Isn’t the fact that WordPress has such a fine Search feature a huge advantage when using it as a CMS? I can imaging Search only being not important on a small portfolio site say limited to 5 pages or so.

Lascia una risposta

Grazie per aver scelto di lasciare un commento. Tenga presente che tutti i commenti sono moderati in base alle nostre politica dei commenti e il suo indirizzo e-mail NON sarà pubblicato. Si prega di NON utilizzare parole chiave nel campo del nome. Avremo una conversazione personale e significativa.