Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 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:

Description

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. https://prnt.sc/rq00x0

I just checked for solutions online and by mistake I got on a random site that google indexed https://jeanbaptisteaudras.com/en/technical/ - 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
https://github.com/WordPress/WordPress/commit/f60094679f4cae8268f79eff10ac247733377ace#diff-efd15818123d55a117706670be80c15aR4252

Thanks,
Andrei

Change History (8)

#1 follow-up: @SergeyBiryukov
5 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.

Last edited 5 years ago by SergeyBiryukov (previous) (diff)

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

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

Thanks for the clarifications,
Andrei

#3 @scorbaciufermecat
5 years ago

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

#4 @SergeyBiryukov
5 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted

No worries, thanks for the follow-up!

#5 @SergeyBiryukov
5 years ago

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

#6 @SergeyBiryukov
5 years ago

#49755 was marked as a duplicate.

#7 @SergeyBiryukov
5 years ago

#49998 was marked as a duplicate.

#8 @SergeyBiryukov
5 years ago

#49994 was marked as a duplicate.

Note: See TracTickets for help on using tickets.