WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 7 weeks ago

#39601 closed enhancement (fixed)

In get_term_link() : we should be able to filter the term link structure before token replacement occurs

Reported by: nikeo Owned by: boonebgorges
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.7.1
Component: Taxonomy Keywords: has-patch needs-testing
Focuses: Cc:

Description

Hi!

We can currently filter the permalink post structure in get_permalink() with pre_post_link. ( https://core.trac.wordpress.org/browser/tags/4.7/src/wp-includes/link-template.php#L118 )

It woud be useful to have the same possiblity with term links in get_term_link() ( https://core.trac.wordpress.org/browser/tags/4.7/src/wp-includes/taxonomy.php#L3834 ), with a filter. For example with a pre_term_link filter.

That would allow developers to easily disable fancy links for terms in a given context, which is possible right now for posts but not easy to achieve with terms.

Hope this makes sense, thanks !

Attachments (3)

39601.patch (853 bytes) - added by nikeo 8 months ago.
39601.diff (618 bytes) - added by bhargavbhandari90 8 months ago.
39601.2.patch (618 bytes) - added by bhargavbhandari90 8 months ago.

Download all attachments as: .zip

Change History (14)

#1 @SergeyBiryukov
8 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

@nikeo
8 months ago

#2 @nikeo
8 months ago

@SergeyBiryukov
pre_term_link is available for the filter name

#3 @SergeyBiryukov
8 months ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 4.8

#4 @jbpaul17
5 months ago

  • Keywords needs-testing added

This needs review and an owner if its going to land in 4.8.

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


5 months ago

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


4 months ago

#7 @jbpaul17
4 months ago

  • Milestone changed from 4.8 to 4.8.1

Punting to 4.8.1 per today's bug scrub.

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


2 months ago

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


2 months ago

#10 @jbpaul17
2 months ago

  • Milestone changed from 4.8.1 to 4.9

Per today's bug scrub, we'll punt this as the focus for 4.8.1 is regressions only.

#11 @boonebgorges
7 weeks ago

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

In 41191:

Taxonomy: Introduce pre_term_link filter.

This filter allows developers to filter the taxonomy permalink
structure before a term's permalink is generated. It parallels
the 'pre_post_link' filter for the 'post' post type.

Props nikeo.
Fixes #39601.

Note: See TracTickets for help on using tickets.