I am building a plugin that allows users to PPK encrypt their users' IP/email data. Thus, IP/email data is set to dummy values in the comments table and encrypted values are stored in corresponding meta fields. I'm successfully using the comment_email hook to lookup email addresses in the admin comments browser from my encrypted meta values.

When editing a comment in the admin interface, in the Author box the email field is preceded by the label "E-mail (send e-mail)", where the text in brackets is hyperlinked to the email address. My hook appears to operate correctly there, retrieving the encrypted email address from comment metadata and decrypting it before returning it.

However in the edit field itself, the real (dummy) contents of wp_comments.comment_author_email is revealed. Is there a hook I can use to modify this before the screen opens? I thought perhaps preprocess_comment would do it, but it doesn't seem to be called.

(I can solve this by adding an AJAX op to this screen and modifying the edit box contents after the screen is rendered. However, that's a bit hacky, and may be impossible if I try to apply it to the Quick Edit AJAX feature).

  • You want to display the decrypted email address in the text field? Commented Jan 1, 2013 at 16:45
  • @RutwickGangurde - yes indeed. My plan would then be to re-encrypt it, save that to meta data, and overwrite the value in the comment table with a dummy value again.
    – halfer
    Commented Jan 1, 2013 at 16:47
  • 1
    Glad you found a solution below! :) Commented Jan 2, 2013 at 5:55

1 Answer 1


You have to filter 'get_comment'. The filter is part of the function with the same name. It is called in wp-admin/comment.php?action=editcomment and the comment is passed to the edit form where you see the email.

The parameter is a comment object, you can change the email value here.

  • Aha, too easy! I will give that a try, thanks. Oddly, I can't find that in the filter reference - should that be in there?
    – halfer
    Commented Jan 1, 2013 at 16:50
  • @halfer Always read the core source code, do not rely on third party documentation. Hooks are moving targets, and very few people keep the codex up to date. I found that by looking at wp-admin/comment.php and wp-includes/comment.php.
    – fuxia
    Commented Jan 1, 2013 at 16:52
  • Heh, Wordpress is a third party? :-p. Fair point though, I will bear that in mind.
    – halfer
    Commented Jan 1, 2013 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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