WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/29/2018 12:23:11 AM (2 years ago)
Author:
danielbachhuber
Message:

Block Editor: Preload wp/v2/media with OPTIONS for caps check.

Also introduces a block_editor_preload_paths filter for plugins and themes to preload additional data.

Props imath, mattheu.
Fixes #45194.

File:
1 edited

Legend:

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

    r43816 r43833  
    5050    sprintf( '/wp/v2/types/%s?context=edit', $post_type ),
    5151    sprintf( '/wp/v2/users/me?post_type=%s&context=edit', $post_type ),
    52 );
     52    array( '/wp/v2/media', 'OPTIONS' ),
     53);
     54
     55/**
     56 * Preload common data by specifying an array of REST API paths that will be preloaded.
     57 *
     58 * Filters the array of paths that will be preloaded.
     59 *
     60 * @since 5.0.0
     61 *
     62 * @param array  $preload_paths Array of paths to preload.
     63 * @param object $post          The post resource data.
     64 */
     65$preload_paths = apply_filters( 'block_editor_preload_paths', $preload_paths, $post );
    5366
    5467/*
Note: See TracChangeset for help on using the changeset viewer.