Last active
January 30, 2021 18:21
-
-
Save wormeyman/319abae148702883aa95f2f55262f2fe to your computer and use it in GitHub Desktop.
WordPress remove website field from comment form. Known to work with Generate Press
This file contains hidden or 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
{ | |
"generator": "Code Snippets v2.14.0", | |
"date_created": "2021-01-30 18:21", | |
"snippets": [ | |
{ | |
"name": "GP Remove website field from comment form", | |
"desc": "Remove the website field from a WordPress comment form, this is known to work well with Generate Press. There is no need for the website field anymore it is usually only used for spammy backlinks that are going to be \"no followed\" anyways.", | |
"tags": ["php", "WordPress", "Comments"], | |
"scope": "global", | |
"code": "add_action( 'after_setup_theme', 'tu_add_comment_url_filter' );\nfunction tu_add_comment_url_filter() {\n add_filter( 'comment_form_default_fields', 'tu_disable_comment_url', 20 );\n}\n\nfunction tu_disable_comment_url($fields) {\n unset($fields['url']);\n return $fields;\n}", | |
"priority": "10" | |
} | |
] | |
} |
This file contains hidden or 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 | |
/** | |
* GP Remove website field from comment form | |
*/ | |
add_action( 'after_setup_theme', 'tu_add_comment_url_filter' ); | |
function tu_add_comment_url_filter() { | |
add_filter( 'comment_form_default_fields', 'tu_disable_comment_url', 20 ); | |
} | |
function tu_disable_comment_url($fields) { | |
unset($fields['url']); | |
return $fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment