Last active
February 4, 2016 13:11
-
-
Save joecue/d09c57f380aac876d25b to your computer and use it in GitHub Desktop.
Useful WordPress Snippets
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
//Remove Autolinking Comment Hyperlink | |
remove_filter('comment_text', 'make_clickable', 9); | |
//Require Minimum Comment Length | |
add_filter( 'preprocess_comment', 'minimal_comment_length' ); | |
function minimal_comment_length( $commentdata ) { | |
$minimalCommentLength = 20; | |
if ( strlen( trim( $commentdata['comment_content'] ) ) < $minimalCommentLength ){ | |
wp_die( 'All comments must be at least ' . $minimalCommentLength . ' characters long.' ); | |
} | |
return $commentdata; | |
} | |
//Remove the URL Field from WordPress Comments Form | |
function remove_comment_fields($fields) { | |
unset($fields['url']); | |
return $fields; | |
} | |
add_filter('comment_form_default_fields','remove_comment_fields'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment