at path:
ROOT
/
wp-includes
/
block-supports
/
auto-register.php
run:
R
W
Run
align.php
1.67 KB
2023-08-10 20:48:20
R
W
Run
Delete
Rename
anchor.php
1.54 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
aria-label.php
1.65 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
auto-register.php
2.18 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
background.php
4.05 KB
2025-12-03 21:00:23
R
W
Run
Delete
Rename
block-style-variations.php
9.28 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
block-visibility.php
5.52 KB
2026-07-10 17:22:33
R
W
Run
Delete
Rename
border.php
6.1 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
colors.php
5.39 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
custom-classname.php
1.64 KB
2023-08-10 20:48:20
R
W
Run
Delete
Rename
custom-css.php
9.37 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
dimensions.php
5.21 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
duotone.php
2.67 KB
2024-06-04 05:48:18
R
W
Run
Delete
Rename
elements.php
8.2 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
error_log
5.65 KB
2026-07-11 02:41:06
R
W
Run
Delete
Rename
generated-classname.php
1.7 KB
2023-08-10 20:48:20
R
W
Run
Delete
Rename
layout.php
42.31 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
position.php
4.01 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
settings.php
4.45 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
shadow.php
2.04 KB
2024-06-04 03:36:14
R
W
Run
Delete
Rename
spacing.php
2.68 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
typography.php
27.68 KB
2026-05-21 18:07:37
R
W
Run
Delete
Rename
utils.php
1011 By
2023-08-18 21:29:20
R
W
Run
Delete
Rename
error_log
up
📄
auto-register.php
Save
<?php /** * Auto-register block support. * * @package WordPress * @since 7.0.0 */ /** * Marks user-defined attributes for auto-generated inspector controls. * * This filter runs during block type registration, before the WP_Block_Type * is instantiated. Block supports add their attributes AFTER the block type * is created (via {@see WP_Block_Supports::register_attributes()}), so any attributes * present at this stage are user-defined. * * The marker tells generateFieldsFromAttributes() which attributes should * get auto-generated inspector controls. Attributes are excluded if they: * - Have a 'source' (HTML-derived, edited inline not via inspector) * - Have role 'local' (internal state, not user-configurable) * - Have an unsupported type (only 'string', 'number', 'integer', 'boolean' are supported) * - Were added by block supports (added after this filter runs) * * @since 7.0.0 * @access private * * @param array<string, mixed> $args Array of arguments for registering a block type. * @return array<string, mixed> Modified block type arguments. */ function wp_mark_auto_generate_control_attributes( array $args ): array { if ( empty( $args['attributes'] ) || ! is_array( $args['attributes'] ) ) { return $args; } $has_auto_register = ! empty( $args['supports']['autoRegister'] ); if ( ! $has_auto_register ) { return $args; } foreach ( $args['attributes'] as $attr_key => $attr_schema ) { // Skip HTML-derived attributes (edited inline, not via inspector). if ( ! empty( $attr_schema['source'] ) ) { continue; } // Skip internal attributes (not user-configurable). if ( isset( $attr_schema['role'] ) && 'local' === $attr_schema['role'] ) { continue; } // Skip unsupported types (only 'string', 'number', 'integer', 'boolean' are supported). $type = $attr_schema['type'] ?? null; if ( ! in_array( $type, array( 'string', 'number', 'integer', 'boolean' ), true ) ) { continue; } $args['attributes'][ $attr_key ]['autoGenerateControl'] = true; } return $args; } // Priority 5 to mark original attributes before other filters (priority 10+) might add their own. add_filter( 'register_block_type_args', 'wp_mark_auto_generate_control_attributes', 5 );