Performance: Filter hooks
MEDIUM IMPACT
Filter hooks affect how WordPress modifies data before output, impacting server processing time and page generation speed.
<?php add_filter('the_content', function($content) { return str_replace('foo', 'bar', $content); }); ?>
<?php add_filter('the_content', function($content) { sleep(1); return $content; }); ?>
| Pattern | Server Processing | Delay | Impact on LCP | Verdict |
|---|---|---|---|---|
| Heavy filter with sleep or DB calls | High CPU and wait | Blocks 1000ms+ | Delays LCP significantly | [X] Bad |
| Simple string replacement filter | Minimal CPU | Blocks <10ms | Negligible LCP impact | [OK] Good |