Articles of comments

Returning error upon comment being flagged as spam

Hello Im using a custom filter that hooks to pre_comment_approved to look for bad words in a custom way. Now when the comment gets flagged it returns spam. How could I post back an error to the comments page so the user is aware that his/her email was sent to spam because of the use […]

If post exists, make it a comment in existing post with same name?

Is it possible to make a comment out of a post that already exists (with the same name). For example, if the post ‘Hello World’ exists and a users posts another ‘Hello World’ post, it should make the second post a comment beneath the first post… How can I do this?

Fatal error: Cannot redeclare comment_theme()

I have this wordpress site build up. In the blog section my post is getting repeated which I do not want how can I get rid of this situation Use this link: http://rymahrice.com/some-energy-drinks-contain-too-much-caffeine-for-kids/ scroll down and you will notice the error and the whole post being repeated. Below is the code: <?php /* The template […]

comments_template not working correcly in custom template files

In a template file that I am using as page, I want to allow only 2 users to post comments and allow to all other users to only see these comments( not allow them add comments). my template file is: <?php get_header(); ?> <?php if (get_current_user_id()==1 or get_current_user_id()==2 ) { comments_template( ”, true ); } […]

An action hook where a comment meta is updated

By analogy to the hook on post meta update, I use the following code for hooking when comment meta value is updated. My comment meta key is “consider” and can have 2 values: 0 and 1. My Goal is to count number of comments with consider=1, and when this count reaches 10, perform some operations. […]

Separate jQuery for Individual Comments?

So far I have designed this function to display rating stars on the front end below every comment: add_filter( ‘comment_text’, ‘additional_fields’ ); function additional_fields ($below) { global $comment; if(!get_comment_meta( get_comment_ID(), ‘rating’, true ) ) { $ratsec = ‘<form action=”‘.get_permalink().'” method=”get” class=”comment-form-rating”>’; $ratsec .= ‘<div id=”stars1″> <div class=”option starr1″>1</div> <div class=”option starr2″>2</div> <div class=”option starr3″>3</div> <div […]

count number of all comments by a user on different (non-repeated) posts

I thank you in advance for your help. I am using WordPress for about 2 years, but always avoiding SQL inside my scripts and looking for built-in functions to perform my goals. To count the comments submitted by a specific user with $user->ID as id, I didn’t find a built-in way, so I am using: […]

WordPress Comment spam issue

I’m Trying to completely disable WordPress Comments. I have manually disabled comments via the WordPress back-end setting and I also created a new blank file called “no-comments-please.php” and then I added the below to my functions.php. Yet the comments show up in their numbers. add_filter( ‘comments_template’, ‘remove_comments_template_on_pages’, 11 ); function remove_comments_template_on_pages( $file ) { if […]

Get rid of “comment” field on non-blog pages

This question already has an answer here: How do I turn comments off for pages, but not posts? 3 answers

Enable comments for post when comments meta box removed

I’ve hit the issue described in ’11: “Enable comments for post with comments meta box removed” and I’d like to ask for your help to adapt the mentioned there code to the current wordpress version. I have a custom post type that must have comments enabled and contributors must not be able to disable comments. […]