get_values() for the post/page location rules loads every post/page:
// src/locations/class-location-post.php (also class-location-page.php)
$posts = get_posts( [
'post_type' => $post_type->name,
'posts_per_page' => -1,
...
] );
Exposed via /interact/v1/get_location_rules/{type} and fired per LocationRule, on mount and on every param change, with no client caching/dedup:
// src/editor/components/location-rules/index.js
useEffect( () => {
apiFetch( { path: `/interact/v1/get_location_rules/${ param }`, method: 'GET' } )...
}, [ param ] )
- Multiple rules => multiple parallel unbounded queries + large payloads.
- Scales badly with site size (thousands of posts).
Recommendation: cache/memoize responses client-side keyed by param
get_values()for thepost/pagelocation rules loads every post/page:Exposed via
/interact/v1/get_location_rules/{type}and fired perLocationRule, on mount and on everyparamchange, with no client caching/dedup:Recommendation: cache/memoize responses client-side keyed by
param