get_block_bindings_supported_attributes( string $block_type ): array
- Since
- 6.9.0, 7.1.0
- Source
wp-includes/block-bindings.php:142
Compatibility
- WordPress
- since 7.1.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in 3 of the 5 tracked releases, added in 7.1.0, and compiles on PHP 7.4 through 8.6-dev.
Parameters
$block_typestring- The block type whose supported attributes are being retrieved.
Return value
array- The list of block attributes that are supported by block bindings.
Performance profile
How much work a call to get_block_bindings_supported_attributes() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 18–21
- Plugin surface
- 2 hooks
- Called by
- 1
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 22.
Third-party callbacks on 'block_bindings_supported_attributes', 'block_bindings_supported_attributes_{$block_type}' run inside this call, and their cost is not bounded by anything here.
1 place in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters()called directly
What one call costs · 1 distinct outcome
One number would be a lie: the work depends on which branch runs. These are every distinct cost get_block_bindings_supported_attributes() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 18–21 | apply_filters(), apply_filters() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 22 | 18–21 | 2 | |
| 8.5 | 22 | 18–21 | 2 | |
| 8.4 | 22 | 18–21 | 2 | |
| 8.3 | 22 | 18–21 | 2 | |
| 8.2 | 22 | 18–21 | 2 | |
| 8.1 | 22 | 18–21 | 2 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 23 | 18–22 | 2 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 2
2 hooks fire while get_block_bindings_supported_attributes() runs, in this order:
- apply_filters( block_bindings_supported_attributes )filterline 167 (+25 into the body)
Filters the supported block attributes for block bindings.
- apply_filters( block_bindings_supported_attributes_{$block_type} )filterline 183 (+41 into the body)
Filters the supported block attributes for block bindings.
Uses · 1
- apply_filters()Calls the callback functions that have been added to a filter hook.
Used by · 1
- get_block_editor_settings()Returns the contextualized block editor settings for a selected editor context.
Source code
function get_block_bindings_supported_attributes( $block_type ) { $block_bindings_supported_attributes = array( 'core/paragraph' => array( 'content' ), 'core/heading' => array( 'content' ), 'core/list-item' => array( 'content' ), 'core/image' => array( 'id', 'url', 'title', 'alt', 'caption' ), 'core/button' => array( 'url', 'text', 'linkTarget', 'rel' ), 'core/post-date' => array( 'datetime' ), 'core/navigation-link' => array( 'url' ), 'core/navigation-submenu' => array( 'url' ), ); $supported_block_attributes = isset( $block_type, $block_bindings_supported_attributes[ $block_type ] ) ? $block_bindings_supported_attributes[ $block_type ] : array(); /** * Filters the supported block attributes for block bindings. * * @since 6.9.0 * * @param string[] $supported_block_attributes The block's attributes that are supported by block bindings. * @param string $block_type The block type whose attributes are being filtered. */ $supported_block_attributes = apply_filters( 'block_bindings_supported_attributes', $supported_block_attributes, $block_type ); /** * Filters the supported block attributes for block bindings. * * The dynamic portion of the hook name, `$block_type`, refers to the block type * whose attributes are being filtered. * * @since 6.9.0 * * @param string[] $supported_block_attributes The block's attributes that are supported by block bindings. */ $supported_block_attributes = apply_filters( "block_bindings_supported_attributes_{$block_type}", $supported_block_attributes ); return $supported_block_attributes;}Changelog
Introduced in 6.9.0. Unchanged from 6.9.7 through 7.1.0.
Signature, return type and hooks compared across 3 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/block-bindings.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.