Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#49411 closed feature request (duplicate)

Missing 'wp_count_terms' filter

Reported by: ddu66's profile ddu66 Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.4
Component: Taxonomy Keywords: needs-patch
Focuses: Cc:

Description

As previously requested by krizkroz (ticket #40696, 3 years ago), function wp_count_terms (wp-includes/taxonomy.php) should filter before returning, exactly the same way function wp_count_posts does (wp-includes/posts.php).

Currently, get_terms filter permit to change the terms that are displayed in the admin screen, but without filter, there is no way to adapt pagination buttons (prev/next/first/last/goto page buttons) that always reflect the number of terms contained in database instead of those filtered/displayed.

To conclude, function wp_count_terms should end by:

return apply_filters('wp_count_terms', get_terms($taxonomy, $args), $taxonomy, $args);

instead of:

return get_terms($taxonomy, $args);

Thanks.
Damien

Change History (1)

#1 @SergeyBiryukov
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

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

Since the original ticket #40696 is still open, let's continue the discussion there. Thanks again!

Note: See TracTickets for help on using tickets.