WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 11 months ago

#42669 closed enhancement (fixed)

Filter for visualization of terms list in admin tables

Reported by: DaveFX Owned by: boonebgorges
Milestone: 5.2 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch dev-feedback
Focuses: administration Cc:
PR Number:

Description

While trying to customize the list of terms for a given post in the admin posts list table, I've found that there's no available filter for that.

Here I'm adding a patch adding a new filter to allow this customization.

Attachments (4)

patch-to-add-filter-admin_term_links.diff (1.3 KB) - added by DaveFX 2 years ago.
Patch that adds the new filter
patch-to-add-filter-admin_term_links.v2.diff (1.2 KB) - added by DaveFX 2 years ago.
Patch that adds the new filter (correct version)
patch-to-add-filter-admin_term_links.v3.diff (1.3 KB) - added by DaveFX 2 years ago.
New version of the patch.
42669.diff (1.7 KB) - added by boonebgorges 11 months ago.

Download all attachments as: .zip

Change History (23)

@DaveFX
2 years ago

Patch that adds the new filter

@DaveFX
2 years ago

Patch that adds the new filter (correct version)

#1 @DaveFX
2 years ago

  • Keywords has-patch added

#2 @DaveFX
2 years ago

  • Keywords dev-feedback 2nd-opinion added

@DaveFX
2 years ago

New version of the patch.

#3 @DaveFX
2 years ago

Added new version for the patch, so how it mimics the behaviour of "term_links-{$taxonomy}" filter.

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


2 years ago

#5 @SergeyBiryukov
2 years ago

  • Component changed from Administration to Taxonomy
  • Milestone changed from Awaiting Review to 5.0
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#6 @SergeyBiryukov
15 months ago

  • Milestone changed from 5.0 to 5.0.1

#7 @pento
13 months ago

  • Milestone changed from 5.0.1 to 5.0.2

#8 @pento
13 months ago

  • Milestone changed from 5.0.2 to 5.0.3

#9 @audrasjb
13 months ago

  • Milestone changed from 5.0.3 to 5.1

Hello,

5.0.3 is going to be released in a couple of weeks. We are currently sorting the remaining tickets in the milestone.

The ticket adds a new filter and still needs a dev-feedback/second-opinion. Since 5.0.3 is going to be a "normal" minor with only self-contained patches and regression/bug fixes. Let's address this ticket in 5.1 which is scheduled for February.

#10 @pento
12 months ago

  • Keywords reporter-feedback added; dev-feedback 2nd-opinion removed
  • Milestone changed from 5.1 to Future Release

@DaveFX: It seems like the functionality you're after would be better done using the get_the_terms filter. Perhaps with a get_current_screen() check to ensure you're on the right screen, if you just want to filter in the post list table.

#11 @DaveFX
12 months ago

@pento I respectfully disagree. By using the get_the_terms filter we would only be able to customize the list of terms returned. But what we want to achieve with this patch is customizing the output of the shown terms, not the actual list of terms.

For example, we want to show only one of the terms using a bold font-weight.

#12 @DaveFX
12 months ago

  • Keywords dev-feedback added; reporter-feedback removed

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


11 months ago

#14 @DaveFX
11 months ago

  • Summary changed from Filter for terms list in admin tables to Filter for visualization of terms list in admin tables

#15 @DaveFX
11 months ago

Pinging @boonebgorges as requested by him in Slack.

#16 @boonebgorges
11 months ago

  • Owner changed from SergeyBiryukov to boonebgorges

@boonebgorges
11 months ago

#17 @boonebgorges
11 months ago

  • Milestone changed from Future Release to 5.2
  • Version 5.1 deleted

Thanks for the patch and for your patience, @DaveFX.

I agree that a get_the_terms filter is not enough in this case, and it seems reasonable to want to filter these links.

42669.diff renames the filter to avoid a dynamic filter name, and to better match other post_column filters. $taxonomy is passed as an argument instead. I've also passed $terms and renamed some variables to be more transparent. Does this seem appropriate to you?

#18 @DaveFX
11 months ago

Thank you, @boonebgorges.

Yes, your changes look good for me.

#19 @boonebgorges
11 months ago

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

In 44822:

Taxonomy: Introduce post_column_taxonomy_links.

This filter allows plugin developers to modify the markup for the links
in taxonomy columns on edit.php.

Props DaveFX.
Fixes #42669.

Note: See TracTickets for help on using tickets.