How to prevent multiple comments

First off WordPress already includes the ability to moderate comments. So unless you’ve disabled this in some way these comments can easily be moderated and deleted if needed. I’m sure that with a bit of custom code you could prevent multiple comments; there may already be a plugin to do this for you. But as … Read more

How to implement just the wp commenting area on my custom site?

The Twenty Eleven Theme has some decent code comments that explain what’s happening. Quick and dirty overview: All comment functionality goes in comments.php. You include it into your template with the aptly named comments_template which does a lot of stuff (sets up the current commentor, ect) other than just including `comments.php Your comments.php template might … Read more

Add an attachment feature to comments

Here is my suggestion: Just download this Comment Images plugin. As of now it only support images. But upload work with all file types. So just make a little tweak like this. So it will display attachment link. Replace line 245 from $comment->comment_content .= ‘<img src=”‘ . $comment_image[‘url’] . ‘” alt=”” />’; to $comment->comment_content .= … Read more

Repositioning ‘Reply’ Link in Comments

Use a custom callback to render the comment content. Inside of the callback function call comment_reply_link() wherever you need it: comment_reply_link( array_merge( $args, array ( ‘add_below’ => ‘comment-body’, ‘depth’ => $reply_depth, // + 1 to offer always a reply link for a consistent UI ‘max_depth’ => $args[‘max_depth’] + 1, ‘before’ => ‘<p class=”reply-line”>’, ‘after’ => … Read more

How to remove the number of a comment in the url slug?

The asker solved the issue with $_SERVER[“HTTP_REFERER”] but refused to post that as a real solution. Let me suggest something better, because the referer might be empty or full of malicious code. Never use that. First, we make sure, we get both arguments for that hook: add_filter( ‘comment_post_redirect’, ‘wpse_97580_comment_redirect’, 10, 2 ); Then we use … Read more

How to get a value from comment meta

Looking at the Codex entry for get_comment_meta(), it appears that when the $single argument is set to TRUE (as you have done), the function returns a string. Try throwing an echo() into the works: <?php echo get_comment_meta( $comment->comment_ID, ‘country’, true ); ?>

How many members have made comments approved for an article?

Your PHP is wrong but what you are doing looks like it should work. $count = $wpdb->get_var( ‘SELECT COUNT(distinct comment_author) FROM ‘ .$wpdb->comments. ‘ WHERE comment_approved = 1 AND comment_post_ID = ‘.$post->ID ); echo $count; Precisely, you were trying to use a variable inside single quotes, which doesn’t work. Variables don’t expand inside single quotes. … Read more

WordPress Recent Comments Widget exclude own comments

You could try this to skip comments made by user with user_id = 1 in the Recent Comments widget: add_action( ‘widgets_init’, ‘custom_recent_comments’ ); function custom_recent_comments(){ add_filter( ‘comments_clauses’, ‘custom_comments_clauses’ ); } where function custom_comments_clauses( $clauses ){ $clauses[‘where’] .= ” AND user_id != 1 “; // EDIT return $clauses; } In a similar way you can target … Read more

Problem with WordPress Comment

ok, here is how we solved it together 😉 We checked the following: the comments are visible in the backend. the comment status is approved for all the comments. we need to use comments_template() in the template file single.php. remove the extra form (the input fields), since comment_form() is used. It’s informative to view the … Read more

Can I turn off further comments on a single page?

You can change the setting in the Discussion post meta box: (If you can’t see this meta box on your post edit screen, go to the Screen Options tab and check the box next to ‘Discussion’) Changing this setting will not delete existing comments. It will just turn off the ability to comment as long … Read more