Performance: Taxonomy term management
MEDIUM IMPACT
This affects page load speed and interaction responsiveness when managing and displaying taxonomy terms in WordPress.
<?php $terms = wp_get_post_terms(get_the_ID(), 'category'); foreach($terms as $term) { echo esc_html($term->name); } ?>
<?php $terms = get_terms(array('taxonomy' => 'category', 'hide_empty' => false)); foreach($terms as $term) { echo $term->name; } ?>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Fetching all terms without filtering | High (many nodes) | Multiple reflows due to large DOM | High paint cost | [X] Bad |
| Fetching only post-related terms | Low (few nodes) | Single reflow | Low paint cost | [OK] Good |
| Loading all admin terms without pagination | High (many nodes) | Multiple reflows | High paint cost | [X] Bad |
| Loading admin terms with pagination | Moderate (limited nodes) | Few reflows | Moderate paint cost | [OK] Good |