Filter hook 'block_editor_rest_api_preload_paths'

in WP Core File wp-includes/block-editor.php at line 707

View Source

block_editor_rest_api_preload_paths

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

Hook Information

File Location wp-includes/block-editor.php View on GitHub
Hook Type Filter
Line Number 707

Hook Parameters

Type Name Description
(string|string[])[] $preload_paths Array of paths to preload.
WP_Block_Editor_Context $block_editor_context The current block editor context.

Usage Examples

Basic Usage
<?php
// Hook into block_editor_rest_api_preload_paths
add_filter('block_editor_rest_api_preload_paths', 'my_custom_filter', 10, 2);

function my_custom_filter($preload_paths, $block_editor_context) {
    // Your custom filtering logic here
    return $preload_paths;
}

Source Code Context

wp-includes/block-editor.php:707 - How this hook is used in WordPress core
<?php
 702  	 * @since 5.8.0
 703  	 *
 704  	 * @param (string|string[])[]     $preload_paths        Array of paths to preload.
 705  	 * @param WP_Block_Editor_Context $block_editor_context The current block editor context.
 706  	 */
 707  	$preload_paths = apply_filters( 'block_editor_rest_api_preload_paths', $preload_paths, $block_editor_context );
 708  
 709  	if ( ! empty( $block_editor_context->post ) ) {
 710  		$selected_post = $block_editor_context->post;
 711  
 712  		/**

PHP Documentation

<?php
/**
	 * Filters the array of REST API paths that will be used to preloaded common data for the block editor.
	 *
	 * @since 5.8.0
	 *
	 * @param (string|string[])[]     $preload_paths        Array of paths to preload.
	 * @param WP_Block_Editor_Context $block_editor_context The current block editor context.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/block-editor.php
Related Hooks

Related hooks will be displayed here in future updates.