post_comments_feed_link

Displays the comment feed link for a post.

Description

post_comments_feed_link( (string) $link_text = '', (string) $post_id = '', (string) $feed = '' ); 

Prints out the comment feed link for a post. Link text is placed in the anchor. If no link text is specified, default text is used. If no post ID is specified, the current post is used.

Parameters (3)

0. $link_text — Optional. (string) => ''
Descriptive link text. Default Comments Feed..
1. $post_id — Optional. (string) => ''
Post ID. Default is the ID of the global $post..
2. $feed — Optional. (string) => ''
Feed format. Default empty.

Usage

  1. if ( !function_exists( 'post_comments_feed_link' ) ) { 
  2. require_once ABSPATH . WPINC . '/link-template.php'; 
  3.  
  4. // Optional. Descriptive link text. Default 'Comments Feed'. 
  5. $link_text = ''; 
  6.  
  7. // Optional. Post ID. Default is the ID of the global `$post`. 
  8. $post_id = ''; 
  9.  
  10. // Optional. Feed format. Default empty. 
  11. $feed = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = post_comments_feed_link($link_text, $post_id, $feed); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/link-template.php  
  1. function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) { 
  2. $url = get_post_comments_feed_link( $post_id, $feed ); 
  3. if ( empty( $link_text ) ) { 
  4. $link_text = __('Comments Feed'); 
  5.  
  6. $link = '<a href="' . esc_url( $url ) . '">' . $link_text . '</a>'; 
  7. /** 
  8. * Filters the post comment feed link anchor tag. 
  9. * @since 2.8.0 
  10. * @param string $link The complete anchor tag for the comment feed link. 
  11. * @param int $post_id Post ID. 
  12. * @param string $feed The feed type, or an empty string for the default feed type. 
  13. */ 
  14. echo apply_filters( 'post_comments_feed_link_html', $link, $post_id, $feed );