Purpose
Registration surface for performance self-check handlers. WR’s self-check iterates over all registered handlers and packages their reports into one artefact. Child plugins own performance-relevant code paths; this filter lets them expose those paths to the self-check without direct coupling.
There are two equivalent registration paths — use whichever fits your plugin:
- Programmatic:
PerfHandlers::register( 'yourplugin_form_perf', $callable ) - WordPress filter: return your handlers from
wr_perf_handlers
Usage
add_filter( 'wr_perf_handlers', function ( array $handlers ): array {
$handlers['yourplugin_form_perf'] = static function (): PerfHandlerReport {
// measure your hot path and return a report
};
return $handlers;
} );Parameters
$handlers (array<string, callable>): Map of handler id → callable returning aPerfHandlerReport. Add your handlers and return the array.
