WP_Ajax_Response example

if ( $comment ) {
            $comment_status = $comment->comment_approved;
        }

        if ( 1 === (int) $comment_status ) {
            $comment_link = get_comment_link( $comment );
        }

        $counts = wp_count_comments();

        $x = new WP_Ajax_Response(
            array(
                'what'         => 'comment',
                // Here for completeness - not used.                 'id'           => $comment_id,
                'supplemental' => array(
                    'status'               => $comment_status,
                    'postId'               => $comment ? $comment->comment_post_ID : '',
                    'time'                 => $time,
                    'in_moderation'        => $counts->moderated,
                    'i18n_comments_text'   => sprintf(
                        /* translators: %s: Number of comments. */
                        
Home | Imprint | This part of the site doesn't use cookies.