Changeset 64438
- Timestamp:
- 10/17/2026 04:45:30 PM (5 days ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/options-connectors.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/options-connectors.php
r63531 r64438 33 33 $parent_file = 'options-general.php'; 34 34 35 /** 36 * Preloads the REST API responses the Connectors UI fetches on mount. 37 * 38 * Without this, the page does a network round-trip for site settings, 39 * plugin capability discovery, and each connector's plugin record after 40 * the JS hydrates, which noticeably delays first paint. 41 * 42 * @since 7.2.0 43 * @access private 44 * 45 * @param array<string|string[]> $preload_paths Paths already queued for preloading. 46 * @return array<string|string[]> Paths with the Connectors-specific requests appended. 47 * 48 * @phpstan-param array<non-falsy-string|array{ non-falsy-string, 'GET'|'OPTIONS' }> $preload_paths 49 * @phpstan-return array<non-falsy-string|array{ non-falsy-string, 'GET'|'OPTIONS' }> 50 */ 51 function _wp_connectors_preload_paths( array $preload_paths ): array { 52 // getEntityRecord( 'root', 'site' ) in use-connector-plugin.ts / ai-plugin-callout.tsx. 53 $preload_paths[] = '/wp/v2/settings'; 54 55 // canUser( 'create', { kind: 'root', name: 'plugin' } ) in stage.tsx. 56 $preload_paths[] = array( '/wp/v2/plugins', 'OPTIONS' ); 57 58 // AiPluginCallout in routes/connectors-home/ai-plugin-callout.tsx queries this 59 // hardcoded ID to check whether the WP AI plugin is installed/active. 60 $preload_paths[] = '/wp/v2/plugins/ai/ai?context=edit'; 61 62 // getEntityRecord( 'root', 'plugin', <basename> ) per connector in use-connector-plugin.ts. 63 foreach ( wp_get_connectors() as $connector_data ) { 64 if ( empty( $connector_data['plugin']['file'] ) ) { 65 continue; 66 } 67 // core-data's plugin entity uses the basename with `.php` stripped 68 // as the record key (see routes/connectors-home/use-connector-plugin.ts). 69 $basename = preg_replace( '/\.php$/', '', plugin_basename( $connector_data['plugin']['file'] ) ); 70 $preload_paths[] = '/wp/v2/plugins/' . $basename . '?context=edit'; 71 } 72 73 return $preload_paths; 74 } 75 add_filter( 'wp_options_connectors_wp_admin_preload_paths', '_wp_connectors_preload_paths' ); 76 35 77 require_once ABSPATH . 'wp-admin/admin-header.php'; 36 78
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)