[wp-trac] [WordPress Trac] #55052: The tag field hangs the browsers when you have a bunch of tags
WordPress Trac
noreply at wordpress.org
Thu Feb 3 22:02:30 UTC 2022
#55052: The tag field hangs the browsers when you have a bunch of tags
--------------------------+--------------------------
Reporter: pikamander2 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.9.1
Component: Query | Version: 5.9
Severity: critical | Resolution:
Keywords: | Focuses: performance
--------------------------+--------------------------
Comment (by costdev):
@pikamander2 Thanks for the patch!
A couple of comments:
1. [https://www.php.net/manual/en/function.intval.php intval()] returns
`int`, so `is_int()` isn't needed here.
2. [https://core.trac.wordpress.org/browser/tags/5.8.1/src/wp-includes
/class-wp-term-query.php#L257 WP_Term_Query::parse_query()] performs
`absint( $query['number'] )`, so `intval()` isn't needed here.
Therefore, the changes to `wp_ajax_ajax_tag_search()` could just be adding
this line to the array:
{{{#!php
'number' => isset( $_GET['number'] ) ? $_GET['number'] : 0,
}}}
@SergeyBiryukov I think adding test coverage for this would ultimately
just be covering `get_terms()`, but let me know if you want some unit
tests for this change.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55052#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list