PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.3.3
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.3.3
1.3.3 1.3.2 1.3.1 1.3.0 1.2.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 All 29 releases
← All changes | includes/class-rest-manager.php +15 -6 1.1.31.3.3 View file →
@@ -30,16 +30,25 @@
30 30 /**
31 31 * Register every route a module declared, prefixed with its slug.
32 32 */
33 33 public static function register_module( Module $module ): void {
34 - $routes = $module->rest_routes();
35 - if ( empty( $routes ) ) {
36 - return;
37 - }
38 -
34 + // rest_routes() is resolved INSIDE the callback, not here.
35 + //
36 + // This method runs at plugins_loaded, before `init`. Calling
37 + // rest_routes() there makes a module build its settings schema, and
38 + // those schemas carry __() labels — so WordPress emitted a
39 + // _load_textdomain_just_in_time notice for every module, on every
40 + // request including the front end (135 per page load with WP_DEBUG on).
41 + // The eager call existed only to skip add_action() for modules with no
42 + // routes; deferring costs one no-op hook each and moves all translation
43 + // work to where it belongs. (QA, 9 Aug 2026)
39 44 add_action(
40 45 'rest_api_init',
41 - static function () use ( $module, $routes ) {
46 + static function () use ( $module ) {
47 + $routes = $module->rest_routes();
48 + if ( empty( $routes ) ) {
49 + return;
50 + }
42 51 $slug = $module->slug();
43 52 foreach ( $routes as $route ) {
44 53 $path = '/' . trim( $slug, '/' ) . '/' . ltrim( $route['path'] ?? '', '/' );
45 54 $path = rtrim( $path, '/' );