I have few custom comment field - phone, stored as comment meta. On comments edit page (edit-comments.php) I display this value in custom column. I also display these values on post edit page (post.php) in comments metabox.

To display comment meta values (before comment text) in comments metabox, I use this get_comment_text filter. Inside this function I check if it was called by wp_ajax_get-comments action, because I want to comment meta value as simple text only in comments metabox.

add_filter( 'get_comment_text', function( $comment_comment_content, $comment, $args ){

    if( doing_action( 'wp_ajax_get-comments' ) ){

        $phone = get_comment_meta( $comment->comment_ID, 'phone', true );

            $out .=  __('Phone') . ': ' . $phone;

        echo $out;


    return $comment_comment_content;

}, 10, 3 );

But right now comment meta value dissapears after quick update and shows only after page refresh, when wp_ajax_get-comments called again. Here is quick example:
Comment meta value dissapears after update

The same problem I have on comments edit page, when I quick update comment - the comment meta value dissapears after quick update.

1) How to update comment text in comments metabox on post edit page after comment quick update?
2) How to update custom columns on comment edit page after comment quick update?

1 Answer 1


I think the action wp_ajax_get-comments is not triggered, if you quick-update the comment. You should check, which ajax request is triggered on the update and then change your code into:

if( doing_action( 'wp_ajax_get-comments' ) || doing_action( 'wp_ajax_quick-update-action' ) ){

I am not able to test this code at the moment, but i hope it works.

  • I understand that I should also check another ajax request related to quick update, but how this wp_ajax_ request called? Of course it's not wp_ajax_quick-update-action
    – anton
    Apr 25, 2017 at 6:41
  • You can open the developer console in your browser (in chrome by hitting F12). There go to the network tab. Now you should trigger your quick-update process. Then you can view the ajax request in the network tab and there you should search for the action parameter.
    – ahendwh2
    Apr 25, 2017 at 6:54
  • Yes, action to check is 'wp_ajax_edit-comment', but this action fires on both, edit comments page and edit post page. Is it possible to check what page we are on inside 'get_comment_text' filter?
    – anton
    Apr 25, 2017 at 7:55
  • Try with get_current_screen() or use the global variable $pagenow
    – ahendwh2
    Apr 25, 2017 at 8:27
  • checked already, unfortunatelly get_current_screen() return null and global $pagenow variable equals to 'admin-ajax.php' on both pages.
    – anton
    Apr 25, 2017 at 8:45

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.