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 disabilitare il collegamento automatico degli URL nei commenti di WordPress

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.

Sapevate che quando un utente aggiunge un URL di testo nei commenti, WordPress lo rende automaticamente cliccabile. Recentemente, uno dei nostri lettori ci ha chiesto se fosse possibile disabilitare il collegamento automatico degli URL di testo nei commenti di WordPress. La risposta è SÌ. In questo articolo vi mostreremo come disabilitare il collegamento automatico degli URL nei commenti di WordPress.

Perché WordPress autolinka gli URL di testo nei commenti?

WordPress converte automaticamente gli URL di testo in link, il che rende più facile visitare il link durante la moderazione dei commenti.

Questo collegamento automatico non viene memorizzato nel database. WordPress rende gli URL cliccabili quando li visualizza sullo schermo nell’area di amministrazione e nella sezione dei commenti sotto gli articoli.

Auto-linked clickable text URL in WordPress comments

Alcuni di questi commenti sono autentici e i commentatori non sapevano come aggiungere un link nei commenti. Ma anche molti commenti di spam contengono URL semplici incollati direttamente nel testo del commento.

Disabilitare il collegamento automatico nei commenti di WordPress

È sufficiente aggiungere questa singola riga di codice nel file functions.php del vostro tema o in un plugin specifico per il sito.

remove_filter( 'comment_text', 'make_clickable', 9 );

WordPress non memorizza gli URL di testo semplice come link nel database. Li trasforma invece in link cliccabili al volo. Questo codice disabilita semplicemente il filtro che rende gli URL cliccabili.

In questo modo gli URL di testo non sono cliccabili nell’area di amministrazione e nella sezione dei commenti sotto i post. Rimuovendo questo codice si riattiva il collegamento automatico.

Se lo si aggiunge al file functions.php del tema, l’aggiornamento del tema sovrascriverà il file functions.

Tenete presente che questo codice funziona solo con URL di testo semplice. Se un utente decide di creare un link aggiungendo il tag HTML appropriato, i link appariranno come dovrebbero.

Se volete disattivare completamente l’HTML nei commenti, date un’occhiata al nostro tutorial su come disattivare l’HTML nei commenti di WordPress.

Speriamo che questo articolo vi abbia aiutato a disabilitare il collegamento automatico degli URL nei commenti di WordPress. Potreste anche voler consultare il nostro elenco dei 16 migliori plugin per migliorare i commenti di WordPress.

Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per i video tutorial 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

23 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. Deniz says

    Thanks for the guide. I added the code to function.php and it worked. So is there a way to exclude my own links from this?

    • WPBeginner Support says

      We do not have a simple way at the moment but should we find a way we would recommend we will be sure to update the article!

      Admin

  3. Pasquale says

    Thanks, this was helpful. I was getting a lot of comments like ‘your website is great…bla bla…check mine’ and a link. Hopefully this will fix it

  4. Abdulrahim safi says

    Hello How can i disable auto link in posts not comments
    when i enter a link in text format ex: http://www.example.com it is automatically changed to hyperlink when i publish post how can i disable this thanks

  5. Sebastien says

    Hello. I’m looking for a way to do just what you mentioned, but only for posts. It seems with a recent WP update, if you type a website address in a post, WP will automatically link to it. For example, if your post contains “google.com” somewhere in the post, then WP will add a link to google. Can we stop that from happening? If so, how? Thank you

    • Bobby says

      Hey Sebastien did you find the solution for your problem as i am also having problem with this.. and i just want to get it disabled.. thanks

  6. StageCoachDriver says

    Could the functions.php in a child theme be used to add ‘remove_filter( ‘comment_text’, ‘make_clickable’, 9 );’ to the theme rather than making changes directly to the theme?

  7. Angel says

    That is really good. In my case, I’ll make a conditional to make my links – as admin – clickable, since I post them on replies to comments.

    Thanks :)

    • Matteo says

      Hi Angel,
      do you mind posting here the code you wrote? I’m interested in having my own links (as admin) cliackable ;)

      Thank you

      • Angel says

        As I am the only person show logs in I am able to use:
        if ( is_user_logged_in() ) {
        remove_filter( ‘comment_text’, ‘make_clickable’, 9 );
        }

    • Ibon Azkoitia says

      Maybe I’m wrong about your situation, but you should not write in your Blog with an Admin User. The “Writer” should have a lower role (editor for example) and have another user with the Admin role for admin stuff.

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.