WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

get_post_reply_link() WP 2.7.0

Retrieves HTML content for reply to post link.

Ищем WP-разработчика! Фулл-тайм, удаленка, хорошая зарплата, соц. пакет. Подробности.
Компания Boosta.
Хуки из функции


Строку|false|null. Link to show comment form, if successful. False, if comments are closed.


get_post_reply_link( $args, $post );

Override default arguments.

По умолчанию: array()

  • add_below(строка)
    The first part of the selector used to identify the comment to respond below. The resulting value is passed as the first parameter to addComment.moveForm(), concatenated as $add_below-$comment->comment_ID.
    По умолчанию: 'post'

  • respond_id(строка)
    The selector identifying the responding comment. Passed as the third parameter to addComment.moveForm(), and appended to the link URL as a hash value.
    По умолчанию: 'respond'

  • reply_text(строка)
    Text of the Reply link.
    По умолчанию: 'Leave a Comment'

  • login_text(строка)
    Text of the link to reply if logged out.
    По умолчанию: 'Log in to leave a Comment'

  • before(строка)
    Text or HTML to add before the reply link.
    По умолчанию: ''

  • after(строка)
    Text or HTML to add after the reply link.
    По умолчанию: ''
Post ID or WP_Post object the comment is going to be displayed on.
По умолчанию: current post

Список изменений

С версии 2.7.0 Введена.

Код get_post_reply_link() WP 5.8.2

function get_post_reply_link( $args = array(), $post = null ) {
	$defaults = array(
		'add_below'  => 'post',
		'respond_id' => 'respond',
		'reply_text' => __( 'Leave a Comment' ),
		'login_text' => __( 'Log in to leave a Comment' ),
		'before'     => '',
		'after'      => '',

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

	$post = get_post( $post );

	if ( ! comments_open( $post->ID ) ) {
		return false;

	if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
		$link = sprintf(
			'<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>',
			wp_login_url( get_permalink() ),
	} else {
		$onclick = sprintf(
			'return addComment.moveForm( "%1$s-%2$s", "0", "%3$s", "%2$s" )',

		$link = sprintf(
			"<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s'>%s</a>",
			get_permalink( $post->ID ) . '#' . $args['respond_id'],
	$formatted_link = $args['before'] . $link . $args['after'];

	 * Filters the formatted post comments link HTML.
	 * @since 2.7.0
	 * @param string      $formatted The HTML-formatted post comments link.
	 * @param int|WP_Post $post      The post ID or WP_Post object.
	return apply_filters( 'post_comments_link', $formatted_link, $post );