The website field is a common component of the Comment Form in any WordPress theme including Astra Theme. Removing the website field may be required in cases when you want to prevent the commenting user from adding their website URL. A few users do it for SEO reasons and here is an easy way to achieve this.
PHP Snippet for free Astra Theme
In the WordPress Dashboard, go to Appearance > Theme Editor and then open the functions.php file of your Astra child theme. Then add the following PHP code at the end.
1 2 3 4 5 6 |
function wpd_remove_comment_website_field( $fields ) { unset( $fields['url'] ); return $fields; } add_filter( 'comment_form_default_fields', 'wpd_remove_comment_website_field', 99 ); |
PHP Snippet for Astra Pro Theme
In the WordPress Dashboard, go to Appearance > Theme Editor and then open the functions.php file of your Astra child theme (make sure Astra Pro plugin is active). Then add the following PHP code at the end.
1 2 3 4 5 6 |
function wpd_remove_comment_website_field( $fields ) { unset( $fields['url'] ); return $fields; } add_filter( 'astra_comment_form_default_fields_markup', 'wpd_remove_comment_website_field', 99 ); |
Leave a Reply