1

Its been 3 days now I am fighting to resolve the issue here:

An action hook where a comment meta is updated

I am pretty sure, even if I am a beginner, that the hook update_comment_meta doesnt exist, and that it is not possible to use something like:

add_action( 'update_comment_meta', 'do_soemthing', 10, 4);

Any confirmations, or objections are highly welcomed.

5
  • How is this question different from the one you asked earlier and linking to?
    – Rarst
    Jul 4, 2013 at 14:22
  • Thank you Rarst for your time. In fact, after too much time looking for the solution to my linked question, I start even believing that there is no hook with the name update_comment_meta. I came back here to get confirmation that there is a hook with such name, because really no ressources on internet about this (also I am newbie). Jul 4, 2013 at 14:26
  • @Rarst, I use update_post_meta with no problems, and when I use the same way update_comment_meta, it doesnt work, all code in my callback is executing outside, but never inside callback. I come here for expert ideas, really no discussion about this hook on internet . Jul 4, 2013 at 14:30
  • Please elaborate on how you are using the hook in core. From the answer you got it does exist and should work.
    – Rarst
    Jul 4, 2013 at 14:31
  • I think the linked topic explains how I am using the hook. I will give more explanations as an edit. Also I will accept the answer above since you also confirm it. Jul 4, 2013 at 14:33

1 Answer 1

3

Well, it's a little bit complicated ;)

If you will search update_comment_meta hook, you won't find it.

But it exists :)

There is update_comment_meta function and it calls update_metadata function with first param set to comment.

This update_metadata function does something like this (meta.php line 149):

do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );

where $meta_type is the first param of this function.

So it will be update_comment_meta when this function is called by update_comment_meta function (because $meta_type is then equal to 'comment').

2
  • thank you for your answer, I am totally agreeing with the logic behind your answer, and this is the logic I followed, but unfortunately the calleback function never executes. Did you checked my linked post? Thanks Jul 4, 2013 at 13:35
  • Well, I did not. I'll check it later today. Jul 4, 2013 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.