Make WordPress Core


Ignore:
Timestamp:
06/03/2024 12:35:47 PM (6 months ago)
Author:
Bernhard Reiter
Message:

Block Hooks: Move Posts controller hooked blocks injection logic.

In a similar vein as [58291], this changeset introduces a new insert_hooked_blocks_into_rest_response function and hooks it to the rest_prepare_wp_navigation filter.

This is part of an ongoing effort to move Block Hooks related code out of the Navigation block. Specifically, insert_hooked_blocks_into_rest_response is based on block_core_navigation_insert_hooked_blocks_into_rest_response. Eventually, it will be possible to deprecate the latter.

Follow-up to [58291].

See #60759.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r58291 r58292  
    761761add_filter( 'rest_pre_insert_wp_navigation', 'update_ignored_hooked_blocks_postmeta' );
    762762
     763// Inject hooked blocks into the wp_navigation post type REST response.
     764add_filter( 'rest_prepare_wp_navigation', 'insert_hooked_blocks_into_rest_response', 10, 2 );
     765
    763766unset( $filter, $action );
Note: See TracChangeset for help on using the changeset viewer.