Support » Developing with WordPress » Issue about removing website field from Comment

  • I want to remove the website filed from the comment option. But some of my visitors are already commented on my site with their websites.

    What is the proper way to safely remove all the websites from the approved comments?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @tipsmania,

    Insert the following code in your functions file.

    add_filter( 'comment_form_default_fields', 'comment_website_remove' );
    function comment_website_remove( $fields ) {
    	if ( isset( $fields['url'] ) ) {
    		unset( $fields['url'] );
    	}
    
    	return $fields;
    }

    Hi @tipsmania,
    If you want to remove Website field completely then add the code given by @dixitadusara.
    Another way to handle this is having website field but disable the linking of website URL.
    If you want to implement the same kindly add the following code in theme’s function file:

    if (!function_exists("disable_comment_author_links")) {
    
        function disable_comment_author_links($author_link) {
            return strip_tags($author_link);
        }
    
        add_filter('get_comment_author_link', 'disable_comment_author_links');
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Issue about removing website field from Comment’ is closed to new replies.