On this page
post_comments_feed_link( string $link_text = '', int $post_id = '', string $feed = '' )
Displays the comment feed link for a post.
Description
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
$link_textstring Optional-
Descriptive link text. Default 'Comments Feed'.
Default:
'' $post_idint Optional-
Post ID. Default is the ID of the global
$post.Default:
'' $feedstring Optional-
Feed type. Possible values include
'rss2','atom'.
Default is the value of get_default_feed() .Default:
''
Source
File: wp-includes/link-template.php. View all references
function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
$url = get_post_comments_feed_link( $post_id, $feed );
if ( empty( $link_text ) ) {
$link_text = __( 'Comments Feed' );
}
$link = '<a href="' . esc_url( $url ) . '">' . $link_text . '</a>';
/**
* Filters the post comment feed link anchor tag.
*
* @since 2.8.0
*
* @param string $link The complete anchor tag for the comment feed link.
* @param int $post_id Post ID.
* @param string $feed The feed type. Possible values include 'rss2', 'atom',
* or an empty string for the default feed type.
*/
echo apply_filters( 'post_comments_feed_link_html', $link, $post_id, $feed );
}
Hooks
- apply_filters( 'post_comments_feed_link_html',
string $link ,int $post_id ,string $feed ) -
Filters the post comment feed link anchor tag.
Related
Uses
| Uses | Description |
|---|---|
| get_post_comments_feed_link() wp-includes/link-template.php | Retrieves the permalink for the post comments feed. |
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| esc_url() wp-includes/formatting.php | Checks and cleans a URL. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| comments_rss_link() wp-includes/deprecated.php | Print RSS comment feed link. |
Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/post_comments_feed_link