wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



block_core_navigation_insert_hooked_blocks_into_rest_response › WordPress Function

Seit6.5.0
Veraltetn/v
block_core_navigation_insert_hooked_blocks_into_rest_response ( $response, $post )
Parameter: (2)
  • (WP_REST_Response) $response The response object.
    Erforderlich: Ja
  • (WP_Post) $post Post object.
    Erforderlich: Ja
Gibt zurück:
  • (WP_REST_Response) The response object.
Definiert in:
Codex:

Hooks into the REST API response for the core/navigation block and adds the first and last inner blocks.



Quellcode

function block_core_navigation_insert_hooked_blocks_into_rest_response( $response, $post ) {
	if ( ! isset( $response->data['content']['raw'] ) || ! isset( $response->data['content']['rendered'] ) ) {
		return $response;
	}
	$parsed_blocks = parse_blocks( $response->data['content']['raw'] );
	$content       = block_core_navigation_insert_hooked_blocks( $parsed_blocks, $post );

	// Remove mock Navigation block wrapper.
	$content = block_core_navigation_remove_serialized_parent_block( $content );

	$response->data['content']['raw'] = $content;

	/** This filter is documented in wp-includes/post-template.php */
	$response->data['content']['rendered'] = apply_filters( 'the_content', $content );

	return $response;
}