get_comment_text example

switch ( $key ) {
                case 'comment_author':
                case 'comment_author_email':
                case 'comment_author_url':
                case 'comment_author_IP':
                case 'comment_agent':
                case 'comment_date':
                    $value = $comment->{$key};
                    break;

                case 'comment_content':
                    $value = get_comment_text( $comment->comment_ID );
                    break;

                case 'comment_link':
                    $value = get_comment_link( $comment->comment_ID );
                    $value = sprintf(
                        '<a href="%s" target="_blank" rel="noopener">%s</a>',
                        esc_url( $value ),
                        esc_html( $value )
                    );
                    break;
            }

            

function comment_text( $comment_id = 0, $args = array() ) {
    $comment = get_comment( $comment_id );

    $comment_text = get_comment_text( $comment$args );

    /** * Filters the text of a comment to be displayed. * * @since 1.2.0 * * @see Walker_Comment::comment() * * @param string $comment_text Text of the comment. * @param WP_Comment|null $comment The comment object. Null if not found. * @param array $args An array of arguments. */

function comment_author_rss() {
    echo get_comment_author_rss();
}

/** * Displays the current comment content for use in the feeds. * * @since 1.0.0 */
function comment_text_rss() {
    $comment_text = get_comment_text();
    /** * Filters the current comment content for use in a feed. * * @since 1.5.0 * * @param string $comment_text The content of the current comment. */
    $comment_text = apply_filters( 'comment_text_rss', $comment_text );
    echo $comment_text;
}

return '';
    }

    $comment            = get_comment( $block->context['commentId'] );
    $commenter          = wp_get_current_commenter();
    $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author'];
    if ( empty( $comment ) ) {
        return '';
    }

    $args         = array();
    $comment_text = get_comment_text( $comment$args );
    if ( ! $comment_text ) {
        return '';
    }

    /** This filter is documented in wp-includes/comment-template.php */
    $comment_text = apply_filters( 'comment_text', $comment_text$comment$args );

    $moderation_note = '';
    if ( '0' === $comment->comment_approved ) {
        $commenter = wp_get_current_commenter();

        
Home | Imprint | This part of the site doesn't use cookies.