get_comment_text

Definition:
function get_comment_text( $comment_ID = 0 ) {}

Retrieve the text of the current comment.

Parameters

  • int $comment_ID: The ID of the comment for which to get the text. Optional.

Return values

returns:The comment content

Defined filters

  • get_comment_text
    apply_filters( 'get_comment_text', $comment->comment_content, $comment )

Source code

function get_comment_text( $comment_ID = 0 ) {

	$comment = get_comment( $comment_ID );

	return apply_filters( 'get_comment_text', $comment->comment_content, $comment );

}

1330

get_comment_statuses

Definition:
function get_comment_statuses( ) {}

Retrieve all of the WordPress supported comment statuses.
Comments have a limited set of valid status values, this provides the comment status values and descriptions.

Return values

returns:List of comment statuses.

Source code

function get_comment_statuses( ) {

	$status = array(

		'hold'		=> __('Unapproved'),

		/* translators: comment status  */

		'approve'	=> _x('Approved', 'adjective'),

		/* translators: comment status */

		'spam'		=> _x('Spam', 'adjective'),

	);



	return $status;

}

1328

get_comment_reply_link

Definition:
function get_comment_reply_link($args = array() {}

Retrieve HTML content for reply to comment link.
The default arguments that can be override are ‘add_below’, ‘respond_id’, ‘reply_text’, ‘login_text’, and ‘depth’. The ‘login_text’ argument will be used, if the user must log in or register first before posting a comment. The ‘reply_text’ will be used, if they can post a reply. The ‘add_below’ and ‘respond_id’ arguments are for the JavaScript moveAddCommentForm() function parameters.

Parameters

  • array $args: Optional. Override default options.
  • int $comment: Optional. Comment being replied to.
  • int $post: Optional. Post that the comment is going to be displayed on.

Return values

returns:Link to show comment form, if successful. False, if comments are closed.

Defined filters

  • comment_reply_link
    apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post)

Source code

function get_comment_reply_link($args = array(), $comment = null, $post = null) {

	global $user_ID;



	$defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'),

		'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');



	$args = wp_parse_args($args, $defaults);



	if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] )

		return;



	extract($args, EXTR_SKIP);



	$comment = get_comment($comment);

	if ( empty($post) )

		$post = $comment->comment_post_ID;

	$post = get_post($post);



	if ( !comments_open($post->ID) )

		return false;



	$link = '';



	if ( get_option('comment_registration') && !$user_ID )

		$link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url( wp_login_url( get_permalink() ) ) . '">' . $login_text . '</a>';

	else

		$link = "<a class='comment-reply-link' href='" . esc_url( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";

	return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);

}

1326

get_comment_pages_count

Definition:
function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) {}

Calculate the total number of comment pages.

Parameters

  • array $comments: Optional array of comment objects. Defaults to $wp_query->comments
  • int $per_page: Optional comments per page.
  • boolean $threaded: Optional control over flat or threaded comments.

Return values

returns:Number of comment pages.

Source code

function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) {

	global $wp_query;



	if ( null === $comments && null === $per_page && null === $threaded && !empty($wp_query->max_num_comment_pages) )

		return $wp_query->max_num_comment_pages;



	if ( !$comments || !is_array($comments) )

		$comments = $wp_query->comments;



	if ( empty($comments) )

		return 0;



	if ( !isset($per_page) )

		$per_page = (int) get_query_var('comments_per_page');

	if ( 0 === $per_page )

		$per_page = (int) get_option('comments_per_page');

	if ( 0 === $per_page )

		return 1;



	if ( !isset($threaded) )

		$threaded = get_option('thread_comments');



	if ( $threaded ) {

		$walker = new Walker_Comment;

		$count = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page );

	} else {

		$count = ceil( count( $comments ) / $per_page );

	}



	return $count;

}

1324

get_comment_meta

Definition:
function get_comment_meta($comment_id, $key, $single = false) {}

Retrieve comment meta field for a comment.

Parameters

  • int $comment_id: Comment ID.
  • string $key: The meta key to retrieve.
  • bool $single: Whether to return a single value.

Return values

returns:Will be an array if $single is false. Will be value of meta data field if $single is true.

Source code

function get_comment_meta($comment_id, $key, $single = false) {

	return get_metadata('comment', $comment_id, $key, $single);

}

1322