Guests comment form – prevent duplicate email addresses

function preprocess_mycomment($commentdata) { $existing_comments = get_comments( array(‘post_id’ => 31691) ); // I run the code for one specific page only foreach ($existing_comments as $comment) { $previous_comments = $comment->comment_author_email; // email address send by the current poster if ( $previous_comments == $commentdata[‘comment_author_email’] ) { // comparing the current email address with the previous ones in database. … Read more

Customize the new comment notifications sent to the post author after the comment is approved

Initially it seemed like a good idea to add comment_notification_text inside the pre_comment_on_post hook, but it didn’t go well. So I removed the pre_comment_on_post and just added to comment_notification_text a comment type check, which is related to the CPT for which the comments are. Now my code works fine for both comment categories (moderated and … Read more

How can I filter the user avatar displayed in comments? – get_avatar_url filter works everywhere but not in comments

By default, wp_list_comments() uses the get_avatar() function to display user avatars, which in turn retrieves the avatar URL from Gravatar. However, get_avatar() also applies the get_avatar_url filter before returning the URL, so you can modify the avatar URL for the comments by using that filter. Here’s an example of how you can modify the avatar … Read more

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