Disabling Website URLs in WordPress Comments

These days a lot of spammers submit spam comments that are perfectly legitimate apart from the fact that they link somewhere. So I thought I would disable the website url field in the comments so that comments can focus on conversations rather than self promotion.

The code to do this was fairly straight forward. You just need to add the code below into your themes functions.php (or make a plugin that does it for you).

 * Disable comment author links
 * @param type $author_link
 * @return string
function bm_disable_comment_author_links( $author_link ) {

    return strip_tags( $author_link );


 * Remove URL field from comments
 * @param array $fields
 * @return string
function bm_comment_form_fields( $fields ) {

    $fields['url'] = '';

    return $fields;


add_filter( 'get_comment_author_link', 'bm_disable_comment_author_links' );
add_filter( 'comment_form_default_fields', 'bm_comment_form_fields' );

Was it good/ useful/ a load of old rubbish? Let me know on Mastodon, or BlueSky (or Twitter X if you must).

Link to this page

Thanks for reading. I'd really appreciate it if you'd link to this page if you mention it in your newsletter or on your blog.

WordPress News

The latest WordPress updates from the WPBriefs Podcast.

Related Posts

20 Jul 2016

Empathy in Web Design

I wasn’t able to make WordCamp Europe this year, but they’ve been really quick at getting all of the talks online, and so I have been watching some of them – and this one stood out.Morten Rand-Hendriksen is an experienced...
25 Nov 2010

WordPress Advent – Seasonal WordPress Savings

In January or February this year I had the idea of making some sort of advent calendar website for christmas. I wanted to share something with the online community – I just wasn’t sure what.In mid October I started thinking...