Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#55904 closed enhancement (fixed)

Add a set of fine-grained filters to disable the different types of feed links separately

Reported by: lopo's profile lopo Owned by: audrasjb's profile audrasjb
Milestone: 6.1 Priority: normal
Severity: normal Version:
Component: Feeds Keywords: has-patch has-unit-tests needs-testing needs-dev-note
Focuses: Cc:

Description (last modified by SergeyBiryukov)

The current set of filters to enable/disable display feed links is quite limited.
We have just:

  • feed_links_show_posts_feed to control the main feed
  • feed_links_show_comments_feed to control both the global comments feed, and the comment feed for singular posts.

If you want do disable the other feeds (post type archive, category, tag, custom taxonomy, author archive, search results) you have to unhook feed_links_extra from wp_head, but this removes completely all those feeds + the single post comments feed.

We should introduce a full set of filters to control each one of the feeds independently, included a way to enable/disable the single post comments feed when the global comments feed is disabled/enabled:

  • feed_links_extra_show_post_comments_feed
  • feed_links_extra_show_post_type_archive_feed
  • feed_links_extra_show_category_feed
  • feed_links_extra_show_tag_feed
  • feed_links_extra_show_tax_feed
  • feed_links_extra_show_author_feed
  • feed_links_extra_show_search_feed

All of them should get true as default input, except for feed_links_extra_show_post_comments_feed which should get the output of feed_links_show_comments_feed to ensure backwards compatibility.

Change History (11)

This ticket was mentioned in PR #2773 on WordPress/wordpress-develop by enricobattocchi.


2 years ago
#1

  • Keywords has-patch added

Add a set of fine-grained filters to disable the different types of feed links separately.

Trac ticket: https://core.trac.wordpress.org/ticket/55904

#2 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 6.1

#3 @lopo
2 years ago

  • Keywords has-unit-tests added

#4 follow-up: @mukesh27
2 years ago

Hi there!

Thanks for the ticket and PR.

I have added one small piece of feedback on PR. Please check and address it.

#5 in reply to: ↑ 4 @lopo
2 years ago

Replying to mukesh27:

Hi there!

Thanks for the ticket and PR.

I have added one small piece of feedback on PR. Please check and address it.

Thanks! I just fixed it.

#6 @audrasjb
2 years ago

  • Keywords commit added
  • Owner set to audrasjb
  • Status changed from assigned to accepted
  • Version trunk deleted

The patch looks good to me.
Self assigning for commit.

#7 @audrasjb
2 years ago

  • Keywords needs-testing added; commit removed

After further review, removing commit keyword to allow further testing.

#8 @SergeyBiryukov
2 years ago

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

In 54161:

Feeds: Add a set of fine-grained filters to disable the different types of feed links separately.

The previously available set of filters in the feed_links() function to enable or disable display of various feed links was quite limited:

  • feed_links_show_posts_feed to control the main feed
  • feed_links_show_comments_feed to control both the global comments feed and the comment feed for singular posts.

In order to disable the other feeds (post type archive, category, tag, custom taxonomy, author archive, search results), one would have to unhook feed_links_extra() from wp_head, but that would completely remove all of those feeds, as well as the single post comments feed.

To allow for more flexibility, this commit introduces a full set of filters in the feed_links_extra() function to control each one of the feeds independently, including a way to enable/disable the single post comments feed when the global comments feed is disabled/enabled:

  • feed_links_extra_show_post_comments_feed
  • feed_links_extra_show_post_type_archive_feed
  • feed_links_extra_show_category_feed
  • feed_links_extra_show_tag_feed
  • feed_links_extra_show_tax_feed
  • feed_links_extra_show_author_feed
  • feed_links_extra_show_search_feed

All of them default to true, except for feed_links_extra_show_post_comments_feed which defaults to the result of feed_links_show_comments_feed to ensure backward compatibility.

Follow-up to [33838], [33839], [53125].

Props lopo, mukesh27, audrasjb, SergeyBiryukov.
Fixes #55904.

SergeyBiryukov commented on PR #2773:


2 years ago
#9

Thanks for the PR! Merged in r54161.

#10 @SergeyBiryukov
2 years ago

  • Description modified (diff)

Updated ticket description to match the filter names in the commit, as they were changed to match the function name.

#11 @milana_cap
2 years ago

  • Keywords needs-dev-note added
Note: See TracTickets for help on using tickets.