Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#49738 closed defect (bug) (invalid)

get_term_link will always generate a deprecated notice when used on post_tag or category

Reported by: scorbaciufermecat's profile scorbaciufermecat Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.4
Component: Taxonomy Keywords:
Focuses: Cc:


Using WordPress 5.4-RC5-47533

get_category_link and get_tag_link both in the end call get_term_link which will use a filter that is deprecated for tags and categories.

I just checked for solutions online and by mistake I got on a random site that google indexed - so maybe more people that don't have error reporting set to OFF will see this. Also, as a developer I would like to have debugging ON but I keep getting this notification.

Here is the commit that did that


Change History (8)

#1 follow-up: @SergeyBiryukov
4 years ago

  • Keywords close added; has-screenshots dev-feedback needs-patch removed
  • Severity changed from major to normal

Hi there, welcome to WordPress Trac! Thanks for the report.

This is intentional behavior of apply_filters_deprecated(), it only outputs the deprecated hook message if you have any functions in your plugins or theme specifically hooked to the deprecated tag_link or category_link filter. Those instances should be updated to use term_link instead.

If you don't have any functions hooked to those deprecated filters, it returns early and doesn't do anything.

Version 0, edited 4 years ago by SergeyBiryukov (next)

#2 in reply to: ↑ 1 @scorbaciufermecat
4 years ago

Sorry, it's my fault. I wasn't paying too much attention to the code.

Thanks for the clarifications,

#3 @scorbaciufermecat
4 years ago

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

#4 @SergeyBiryukov
4 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted

No worries, thanks for the follow-up!

#5 @SergeyBiryukov
4 years ago

Created #49759 to consider un-deprecating category_link and tag_link filters.

#6 @SergeyBiryukov
4 years ago

#49755 was marked as a duplicate.

#7 @SergeyBiryukov
4 years ago

#49998 was marked as a duplicate.

#8 @SergeyBiryukov
4 years ago

#49994 was marked as a duplicate.

Note: See TracTickets for help on using tickets.