Why are default comments deprecated?

You shouldn’t copy that file, precisely because it is too bulky. About half of it is implementation of submission form, which was entirely replaced with comment_form() function around that time. So the answer why was it deprecated is roughly: Newer code is more compact Markup belongs in theme For better and more relevant comments.php example … Read more

Comment form validation

Comments processing is done in the file: wp-comments-post.php. You can use the hook pre_comment_on_post to validate the values entered in the comment form fields. function custom_validate_comment_url() { if( !empty( $_POST[‘url’] ) && !preg_match( ‘\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]’, $_POST[‘url’] ) // do you url validation here (I am not a regex expert) wp_die( __(‘Error: please enter a valid url … Read more

How to remove commenters ability to add hyperlinks to comments?

WP runs so many prettifying filters on this stuff that it’s easy to get lost. Here is what I ended up with: remove_filter(‘comment_text’, ‘make_clickable’, 9); add_filter(‘pre_comment_content’, ‘strip_comment_links’); function strip_comment_links($content) { global $allowedtags; $tags = $allowedtags; unset($tags[‘a’]); $content = addslashes(wp_kses(stripslashes($content), $tags)); return $content; } This scrubs out clearly defined links and removes filter that turns plain … Read more

How to add editor-style.css styling to wp_editor on front end for comments

Actually you can include the editor-style.css (or any other stylesheet), just pass a “content_css” value to tinymce that points to a css file: wp_editor( $content, ‘editablecontent’, array( ‘tinymce’ => array( ‘content_css’ => get_stylesheet_directory_uri() . ‘/editor-styles.css’ ) ); So the original posters code would look like: add_filter( ‘comment_form_defaults’, ‘custom_comment_form_defaults’ ); function custom_comment_form_defaults( $args ) { if … Read more

Hook/Filter before and after comments

do_action( ‘comment_form_before’ ); is called on line 1553 of /wp-includes/comment-template.php, right before the output of the comment form, that should handle that one for you. I’ll update this if I can find the hook before the comments. edit It seems like you might be able to modify Walker_Comment (found in the same file as above) … Read more

Where to remove from comment’s feed?

Things added by WordPress core can not be deleted or removed, or better said, shouldn’t be modified directly. Instead, you can use any of the actions and filters. Specifically, to disable comments feeds, you can use this (note the priority parameter): remove_action( ‘wp_head’, ‘feed_links’, 2 ); The above code will remove also other posts feed … Read more

Allow anonymous comments, but prevent spam [closed]

Okay, I’ve (probably) done just enough reading since asking this question, and apparently this combo of anti-spam plugins, works to a very appreciable extent in mitigating spam: Akismet + Cookies for Comments + Impostercide Knowledgeable people agree: Alex aka Viper007Bond uses Akismet and Cookies for Comments on his own blog, alongside having Trackbacks disabled. (Source) … Read more

Threaded comments – deleting parent comment leads to orphan comments

Had this problem on a site where commenter’s would post comments to the wrong posts and comment threads, had to move thousands of comments from one post to more appropriate posts on the site. I used this plugin http://wordpress.org/extend/plugins/move-wordpress-comments/ for fixing threading. With the plugin you have the option of turning the child comments into … Read more