Check if comment was modified

You should be able to do this fairly simply by hooking to the edit_comment action and saving the modified date using update_comment_meta: add_action(‘edit_comment’, ‘my_comment_modified_date’, 10, 2); function my_comment_modified_date($comment_ID, $data) { update_comment_meta($comment_ID, ‘modified_date’, time()); }

Reject Comments Based on Author Email

Here’s a suggestion for a filter: /** * Filters a comment’s approval status before it is set. * * @since 2.1.0 * @since 4.9.0 Returning a WP_Error value from the filter will shortcircuit comment insertion and * allow skipping further processing. * * @param bool|string|WP_Error $approved The approval status. Accepts 1, 0, ‘spam’ or WP_Error. … Read more

How to allow more HTML tags in comment for a certain comment_type

This is untested but should work since it gives you the data you need to work from and runs prior to the pre_comment_content filter where the comment is sanitized. add_filter( ‘preprocess_comment’, ‘wpse_340526_preprocess_comment’ ); function wpse_340526_preprocess_comment( $commentdata ) { if( ‘wpse_response’ === $commentdata[‘comment_type’] ){ global $allowedtags; $allowedtags[‘pre’] = array(‘class’=>array()); $allowedtags[‘h2’] = array(); $allowedtags[‘h3’] = array(); $allowedtags[‘h4’] … Read more

Callback function argument which is required for wp_list_comments ()

wp_list_comments() uses Walker_Comment class to render the output. See Walker_Comment->start_el() method for callback argument: https://developer.wordpress.org/reference/classes/walker_comment/start_el/ And Walker_Comment->end_el() method for end-callback argument: https://developer.wordpress.org/reference/classes/walker_comment/end_el/

How can I fix wp_insert_comment failure when ‘comment_content” includes slanted apostrophe in Excel csv source data

If processed as saved, comments with slanted apostrophes/curled single quotes – ’ – are simply not inserted – they do not appear either in backend comments.php or in the post output. That’s because the wpdb class checks if the comment content contains any invalid (UTF-8) text, and if yes, then wpdb rejects the content and … Read more

Changing the comments link produced by the get_comments_link() and get_comments_pagenum_link() functions

So the solution to the get_comments_pagenum_link() function is straightforward enough: add_filter(‘get_comments_pagenum_link’ , ‘new_get_comments_pagenum_link’); function new_get_comments_pagenum_link($content) { $content = str_ireplace(‘#comments’ , ‘#other’, $content); return $content; } Which filters the output of get_comments_pagenum_link() to replace #content with #other, or any other string you might choose. For the get_comments_link() function, which can’t be filtered, I have simply discovered … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)