Opened 6 years ago
Closed 6 years ago
#44821 closed enhancement (invalid)
Add filter for custom taxonomy per page value in `WP_Term_List_Table`
Reported by: | desrosj | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | |
Focuses: | administration | Cc: |
Description
In WP_Terms_List_Table->prepare_items()
there are two filters, edit_tags_per_page
and edit_categories_per_page
. Neither of these filters are run if the taxonomy being viewed is not a core taxonomy (category or tag).
A new filter should be added that allows the filtering of the per page value for custom taxonomies.
Attachments (4)
Change History (13)
#2
follow-up:
↓ 3
@
6 years ago
- Milestone changed from Awaiting Review to 4.9.9
44821.3.diff seems like a good start.
For consistency with the edit_{$post_type}_per_page filter though, the new filter should probably apply to core taxonomies as well. Any objections to 44821.4.diff?
#3
in reply to:
↑ 2
@
6 years ago
Replying to SergeyBiryukov:
44821.3.diff seems like a good start.
For consistency with the edit_{$post_type}_per_page filter though, the new filter should probably apply to core taxonomies as well. Any objections to 44821.4.diff?
Thank you for the feedback. Yes, I think 44821.4.diff makes more sense.
#4
@
6 years ago
- Keywords close added
I think that I created a ticket prematurely.
In reviewing 44821.4.diff, I noticed that the WP_List_Table->get_items_per_page()
method will actually pass the value through a dynamic filter with the exact same name as the $option
parameter passed to it. Given a custom taxonomy called my_custom_tax
, the filter that runs would be called edit_my_custom_tax_per_page
. This has been in place since [15569], but is not immediately obvious in classes extending WP_List_Table
.
The edit_tags_per_page
and edit_categories_per_page
were old filter names that seem to be left for backward compatibility.
WP_Posts_List_Table
is the only other WP_List_Table
that applies a filter to the per page value (edit_posts_per_page
), but, this filter is called in two other places in core, and is different than edit_post_per_page
(singular) which would be called by the WP_List_Table->get_items_per_page()
method.
I am marking this as a close
candidate. The goal of this ticket is already possible.
#8
@
6 years ago
- Milestone changed from 5.0.3 to 5.1
5.0.3 is going to be released in a couple of weeks. We are currently sorting the remaining tickets in the milestone. It doesn't appear that ticket can be handled in the next couple of weeks (especially as it is tagged "close"). If necessary, let's address it in 5.1 which is coming in February. Feel free to change/ask to change the milestone if you think this issue can be quickly resolved.
#9
@
6 years ago
- Keywords good-first-bug has-patch close removed
- Milestone 5.1 deleted
- Resolution set to invalid
- Status changed from new to closed
Closing this out since it is already possible as noted in ticket:44821#comment:4. If the need for a more specifically named filter arises this can be reopened.
Adds a filter for custom taxonomy terms per page