WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#9712 closed enhancement (fixed)

Filter request: Post comments feed link HTML

Reported by: JohnLamansky Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7.1
Component: Plugins Keywords: has-patch tested
Focuses: Cc:

Description

This filter allows rel/style/class/title attributes to be added to the post comments RSS link.

I'd like to use this filter in a plugin I'm developing. Thanks for your consideration.

Attachments (2)

link-template.php.diff (522 bytes) - added by JohnLamansky 6 years ago.
I named the filter "post_comments_feed_link_html" because "post_comments_feed_link" is already used to filter the href URL.
link-template.php-2.diff (510 bytes) - added by JohnLamansky 6 years ago.
Removes the $link_text argument, as suggested

Download all attachments as: .zip

Change History (11)

@JohnLamansky6 years ago

I named the filter "post_comments_feed_link_html" because "post_comments_feed_link" is already used to filter the href URL.

comment:1 @Denis-de-Bernardy6 years ago

why is the post_comments_feed_link filter not enough?

comment:2 @JohnLamansky6 years ago

The post_comments_feed_link hook filters the link's URL only.

This proposed post_comments_feed_link_html hook would filter the entire <a> element, allowing rel/style/class/title attributes to be added.

comment:3 @Denis-de-Bernardy6 years ago

  • Keywords 2nd-opinion added

maybe the_post_comments_feed_link, to make it consistent with the other hooks?

there also are a couple of other areas where it's called, which might want the filter too.

comment:4 @JohnLamansky6 years ago

Right, it we wanted to be totally consistent, we should rename the existing "the_post_comments_feed_link" filter to "get_post_comments_feed_link" and name this new filter "the_post_comments_feed_link".

Although that would be ideal, such a change could break existing plugins, which is why I suggested that, instead, we could add "_html" to the end of the new hook that would filter the <a> HTML.

comment:5 @jorbin6 years ago

+1
This patch would really help me with a plugin that I am developing.

comment:6 @jorbin6 years ago

  • Keywords dev-feedback added

comment:7 follow-up: @Denis-de-Bernardy6 years ago

  • Keywords tested added; 2nd-opinion dev-feedback removed

I'd remove the $link_text from the filter's arguments, personally.

comment:8 in reply to: ↑ 7 @JohnLamansky6 years ago

Replying to Denis-de-Bernardy:

I'd remove the $link_text from the filter's arguments, personally.

Good point; the $link_text can be obtained by running strip_tags() on the filter's first argument.

@JohnLamansky6 years ago

Removes the $link_text argument, as suggested

comment:9 @azaozz6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [11299]) Post comments feed link HTML filter, props JohnLamansky, fixes #9712

Note: See TracTickets for help on using tickets.