# Blocks

Source: https://uglydev.com/docs/hooks-and-filters/hooks-and-filters-blocks/
Updated: 19 November 2026

## `ugly_blocks_off`

**Filter.** The names of the blocks (their folder) that are turned off. They are not registered: the editor does not offer them and the site shows nothing in their place. Files and fields stay.

```php
add_filter( 'ugly_blocks_off', fn ( $off ) => array( ...$off, 'hero', 'faq' ) );
```

## `ugly_layouts_off`

**Filter.** Layouts of a flexible content to hide from the "Add" menu, as `'group_key.field_name' => array( 'layout', ... )`.

```php
add_filter( 'ugly_layouts_off', function ( $off ) {
	$off['group_page.blocks'] = array( 'hero', 'faq' );
	return $off;
} );
```

## `ugly_register_block_args`

**Filter.** The arguments a block is registered with. Receives the arguments and the name of the block (the folder, without `ugly/`).

```php
add_filter( 'ugly_register_block_args', function ( array $args, string $name ) {
	if ( 'hero' === $name ) {
		$args['category'] = 'design';
	}
	return $args;
}, 10, 2 );
```

## `ugly_block_template`

**Filter.** The render file of a block. Receives the file name and the block name.

```php
add_filter( 'ugly_block_template', function ( string $file, string $name ) {
	return 'hero' === $name ? 'render-hero.php' : $file;
}, 10, 2 );
```
