I think you only want get_comment
and not get_comments
on this line:
$com=get_comments($comment_id);
You are only checking for a single comment, by the ID. get_comments
won’t do that the way you are using it.
There is a check halfway through the update_metadata
function that compares the existing value to new value under some circumstances. That runs before the update_comment_meta
hook and sometimes return
s so that that hook never runs. Admittedly this is a guess, but if you are passing the same value, such as true
every time this may be where it hangs.
The update_{$meta_type}_metadata
hook would fire, but is a filter and not really the best choice for this kind of hook. I am wondering if you shouldn’t be using the edit_comment
hook instead.
Related Posts:
- On WordPress 4.4, how to get the post id using the comment_post hook
- How to direct user after comment save
- Use has_filter on comment_post
- What for is the table “wp_commentmeta” exactly?
- Running a function on comment status change
- Hook to edit an column on comments screen?
- Is it possible to show custom comment metadata in the admin panel?
- Altering the pingback functionality
- Add Comment Custom Field
- count number of user comments with a specific comment meta value
- Upload images with comment
- Add a drop down list to comment form?
- What are the additional fields in wp_comments used for?
- Display comment meta data after quick update
- WordPress Comment. Need some details of wp_comments DB table
- How would I count the number of times a comment meta field’s value is in a post’s entire comments?
- WP 4.4.1 allow empty comments via add_action ‘pre_comment_on_post’
- Get comments from post and sort by commentmeta value
- WordPress custom form action url
- Auto delete comment if Contains
- Do I need to deal with WordPress SQL Injection
- How to sort posts by the average of comment meta values
- Assign author to comment from post edit page
- Comment search plugin
- delete duplicate comments
- Alternative to the filter comment_reply_link
- How to use the ‘comments_number’ filter?
- Get all child comments ids from parent comment id
- custom hooks before a comment is updated/edited in the database
- How to get a value from comment meta
- Name of comment field differs on different sites
- Make every comment go to the spam folder
- How to display comment meta under each comment content
- Update comment meta for all comments of specific post
- How to get Post title by locale with Qtranslate-X
- How can I edit comment meta value before it is saved?
- ‘comment_post’ hook doesn’t seem to work? [closed]
- get_comment_meta not behaving as expected
- What is the point of get_comment_count() if you cannot limit by a comment type?
- count number of all comments by a user on different (non-repeated) posts
- stumped on add_action hook to delete_comment – any ideas?
- How to Trigger comment_form_after action if comment_form() not used
- How to filter comments by comment_meta
- SQL command to delete “pending comments” doesn’t work…?
- Add custom field on admin dashboard comments / reviews
- Top rated posts Average rating issue
- WordPress Commenting System User access and Security
- Comments closed only for contributors
- Add comment meta
- Comment-Meta doesn’t work with latest wordpress update
- add field comment [duplicate]
- What filter or action to replace comments or add new comment system
- Use country flag as user avatar based on comments IP address?
- get_template_part vs action hooks in themes
- Hook after image is uploaded and image sizes generated
- Getting instance variable in scope of ‘wp_enqueue_scripts’
- Comments screen in backend, how to disable email address of commenter for non admins
- Parent comment’s author name
- get_comments_number of depth-1 (Level 1) (1 post)
- List Recent Comments from Across a Multi-site Network
- Number of External Links in Comments – Moderation Option
- Toggle nested comments
- Show last n comments
- Threaded commenting: how to show threads by last active first?
- Is there a Woocommerce hook that fires when applying a coupon but before checking if it’s valid?
- How to add attributes to the comment form tag?
- Problems with comments callback (Argument #1 is not an array?)
- Can WordPress comments have titles and taxonomy?
- Comments system doesn’t like International domains
- Polls with respective comments?
- Why does akismet prevent jetpack comments from appearing in my moderation queue? [closed]
- What does WordPress do if I save a post without content/title? [duplicate]
- Problem with WordPress Comment
- Comments change the template name
- I can’t post comment via REST API
- WordPress scruity issue – Totally disable all comments by CSS — secure enough?
- wp_new_comment requires author url and author email
- get_comments_number() vs. get_post_field( ‘comment_count’, ID )
- Where are comments coded when using custom theme?
- Wrong IP address in comment section
- Action hook to control access to certain parts of my site
- Comments turned off, but ‘Leave a reply’ link still there [duplicate]
- How to output number of comments with link to comments
- action wp_set_comment_status never gets fired when i change the comment status [closed]
- Change status of page after an event (Looking for best practice advice)
- Elementor posts custom query based on tag [closed]
- apply_filters() and call_user_func() to define and call a function outside a class
- Get all comments associated with a specific page ID (comment_post_ID)
- How do I add custom field to Admin comment form and display
- I would like to count number of comments after 5 days ago
- Use action, filter, or hook to append HTML to WordPress plugin function
- Can’t get ID of post that relates to the comment
- Necessary to have a comments.php if there are no comments?
- Inserting comments via a procedure
- WordPress is adding above html
- Passing user meta through comment form
- Display DISQUS on homepage
- How to stop a specific person to comment on my blog? [closed]
- add_action failed to display function by a plugin
- Can you call a filter hook by “add_action”?