Make WordPress Core

Changeset 58904


Ignore:
Timestamp:
08/16/2024 06:21:43 AM (7 weeks ago)
Author:
Mamaduka
Message:

Editor: Fix preloaded REST API paths

When providing an incorrect path to preload, the rest_preload_api_request will silently fail, and nothing will be preloaded.

  • Fix typo for wp_template_part post type preload path for the Site Editor.
  • Do not preload the wp_block post type for post editors. The endpoint doesn't support unbound queries, and the data is no longer needed during editor initialization.

Props kirasong, tyxla, mamaduka.
Fixes #61884.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-blocks.php

    r58690 r58904  
    5656    '/wp/v2/types?context=view',
    5757    '/wp/v2/taxonomies?context=view',
    58     add_query_arg(
    59         array(
    60             'context'  => 'edit',
    61             'per_page' => -1,
    62         ),
    63         rest_get_route_for_post_type_items( 'wp_block' )
    64     ),
    6558    add_query_arg( 'context', 'edit', $rest_path ),
    6659    sprintf( '/wp/v2/types/%s?context=edit', $post_type ),
  • trunk/src/wp-admin/site-editor.php

    r57543 r58904  
    9292    '/wp/v2/types?context=view',
    9393    '/wp/v2/types/wp_template?context=edit',
    94     '/wp/v2/types/wp_template-part?context=edit',
     94    '/wp/v2/types/wp_template_part?context=edit',
    9595    '/wp/v2/templates?context=edit&per_page=-1',
    9696    '/wp/v2/template-parts?context=edit&per_page=-1',
Note: See TracChangeset for help on using the changeset viewer.