Last active
August 29, 2015 14:06
-
-
Save AlphaBlossom/f5fbec9b82fbfe5fd3ba to your computer and use it in GitHub Desktop.
Remove Email and URL Fields from WordPress comments form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag | |
/********************************** | |
* | |
* Filter Comments Form | |
* Remove Email and URL Fields | |
* | |
* @author AlphaBlossom / Tony Eppright | |
* @link http://www.alphablossom.com | |
* | |
************************************/ | |
/* | |
* Remove both Email and URL fields | |
* | |
*/ | |
add_filter( 'comment_form_default_fields', 'youruniqueprefix_remove_comments_form_url_field' ); | |
function youruniqueprefix_remove_comments_form_url_field( $fields ) { | |
if( isset( $fields['email'] ) ) { | |
unset( $fields['email'] ); | |
} | |
if( isset( $fields['url'] ) ) { | |
unset( $fields['url'] ); | |
} | |
return $fields; | |
} | |
/* | |
* Remove Email field | |
* | |
*/ | |
add_filter( 'comment_form_default_fields', 'youruniqueprefix_remove_comments_form_url_field' ); | |
function youruniqueprefix_remove_comments_form_url_field( $fields ) { | |
if( isset( $fields['email'] ) ) | |
unset( $fields['email'] ); | |
return $fields; | |
} | |
/* | |
* Remove URL field | |
* | |
*/ | |
add_filter( 'comment_form_default_fields', 'youruniqueprefix_remove_comments_form_url_field' ); | |
function youruniqueprefix_remove_comments_form_url_field( $fields ) { | |
if( isset( $fields['url'] ) ) | |
unset( $fields['url'] ); | |
return $fields; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment