Make WordPress Core


Ignore:
Timestamp:
09/04/2024 04:15:16 AM (5 weeks ago)
Author:
Mamaduka
Message:

Editor: Update preloaded paths for the site editor

Add the OPTIONS /wp/v2/pages route to the list. The request is made via the useBlockEditorSettings hook at the top of the editor React tree. Preloading should improve the editor's loading time.

Avoid hardcoding paths for the 'attachment' post type; use the rest_get_route_for_post_type_items helper method instead.

Props mamaduka, noisysocks.
See #61884.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/site-editor.php

    r58904 r58984  
    8989
    9090$preload_paths = array(
    91     array( '/wp/v2/media', 'OPTIONS' ),
     91    array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
     92    array( rest_get_route_for_post_type_items( 'page' ), 'OPTIONS' ),
    9293    '/wp/v2/types?context=view',
    9394    '/wp/v2/types/wp_template?context=edit',
Note: See TracChangeset for help on using the changeset viewer.