钩子文档

block_editor_rest_api_preload_paths

💡 云策文档标注

概述

此过滤器用于修改块编辑器预加载常用数据时使用的REST API路径数组。它允许开发者根据当前块编辑器上下文自定义预加载的数据源。

关键要点

  • 过滤器名称为 block_editor_rest_api_preload_paths,用于调整预加载的REST API路径。
  • 接受两个参数:$preload_paths(路径数组)和 $block_editor_context(当前块编辑器上下文对象)。
  • 与 block_editor_rest_api_preload() 函数关联,用于在指定上下文中预加载数据。
  • 自WordPress 5.8.0版本引入。

📄 原文内容

Filters the array of REST API paths that will be used to preloaded common data for the block editor.

Parameters

$preload_paths(string|string[])[]
Array of paths to preload.
$block_editor_contextWP_Block_Editor_Context
The current block editor context.

Source

$preload_paths = apply_filters( 'block_editor_rest_api_preload_paths', $preload_paths, $block_editor_context );

Changelog

Version Description
5.8.0 Introduced.