wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



get_comments_link › WordPress Function

Depuis1.5.0
Dépréciéen/a
get_comments_link ( $post = 0 )
Paramètres:
  • (int|WP_Post) $post Optional. Post ID or WP_Post object. Default is global $post.
    Requis: Non
    Défaut:
Retourne:
  • (string) The link to the comments.
Défini(e) dans:
Codex:

Retrieves the link to the current post comments.



Source

function get_comments_link( $post = 0 ) {
	$hash          = get_comments_number( $post ) ? '#comments' : '#respond';
	$comments_link = get_permalink( $post ) . $hash;

	/**
	 * Filters the returned post comments permalink.
	 *
	 * @since 3.6.0
	 *
	 * @param string      $comments_link Post comments permalink with '#comments' appended.
	 * @param int|WP_Post $post          Post ID or WP_Post object.
	 */
	return apply_filters( 'get_comments_link', $comments_link, $post );
}