Title: WP_Theme::is_block_theme
Published: February 3, 2022
Last modified: August 20, 2026

---

# WP_Theme::is_block_theme(): bool

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_theme/is_block_theme/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme/is_block_theme/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_theme/is_block_theme/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme/is_block_theme/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_theme/is_block_theme/?output_format=md#wp--skip-link--target)

Returns whether this theme is a block-based theme or not.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_theme/is_block_theme/?output_format=md#return)󠁿

 bool

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_theme/is_block_theme/?output_format=md#source)󠁿

    ```php
    public function is_block_theme() {
    	if ( isset( $this->block_theme ) ) {
    		return $this->block_theme;
    	}

    	$paths_to_index_block_template = array(
    		$this->get_file_path( '/templates/index.html' ),
    		$this->get_file_path( '/block-templates/index.html' ),
    	);

    	$this->block_theme = false;

    	foreach ( $paths_to_index_block_template as $path_to_index_block_template ) {
    		if ( is_file( $path_to_index_block_template ) && is_readable( $path_to_index_block_template ) ) {
    			$this->block_theme = true;
    			break;
    		}
    	}

    	return $this->block_theme;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-theme.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-theme.php#L1595)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-theme.php#L1595-L1615)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_theme/is_block_theme/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Theme::get_file_path()](https://developer.wordpress.org/reference/classes/wp_theme/get_file_path/)`wp-includes/class-wp-theme.php` |

Retrieves the path of a file in the theme.

  |

| Used by | Description | 
| [WP_Theme::__construct()](https://developer.wordpress.org/reference/classes/wp_theme/__construct/)`wp-includes/class-wp-theme.php` |

Constructor for [WP_Theme](https://developer.wordpress.org/reference/classes/wp_theme/).

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_theme/is_block_theme/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2Fis_block_theme%2F)
before being able to contribute a note or feedback.