Closed ndiego closed 1 month ago
This would be a snippet that provides an example of the heading-level curation options available in WordPress 6.7.
The snippet will show you how to disable H1, H5, and H6 in the Heading block for all users who are not administrators using PHP.
function example_modify_heading_levels_globally( $args, $block_type ) { $is_administrator = current_user_can( 'edit_theme_options' ); if ( 'core/heading' !== $block_type || $is_administrator ) { return $args; } // Remove H1, H5, and H6. $args['attributes']['levelOptions']['default'] = [ 2, 3, 4 ]; return $args; } add_filter( 'register_block_type_args', 'example_modify_heading_levels_globally', 10, 2 );
This would be a snippet that provides an example of the heading-level curation options available in WordPress 6.7.
The snippet will show you how to disable H1, H5, and H6 in the Heading block for all users who are not administrators using PHP.