WPDev.one
Core Function
View Source on Trac ↗

wp_get_first_block()

wp_get_first_block( mixed $blocks, mixed $block_name )

Finds the first occurrence of a specific block in an array of blocks.

Parameters 2 required

Name / Type Description
$blocks
array

Array of blocks.

Required
$block_name
string

Name of the block to find.

Required

Return Value

(array)
Found block, or empty array if none found.

Function Information

Since Version
6.3.0
Source File
wp-includes/block-editor.php
Advertisement