Title: WP_Theme_JSON_Resolver::style_variation_has_scope
Published: July 16, 2024
Last modified: August 20, 2026

---

# WP_Theme_JSON_Resolver::style_variation_has_scope( array $variation, string $scope ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/style_variation_has_scope/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/style_variation_has_scope/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/style_variation_has_scope/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/style_variation_has_scope/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/style_variation_has_scope/?output_format=md#changelog)

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

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Determines if a supplied style variation matches the provided scope.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/style_variation_has_scope/?output_format=md#description)󠁿

For backwards compatibility, if a variation does not define any scope related property,
e.g. `blockTypes`, it is assumed to be a theme style variation.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/style_variation_has_scope/?output_format=md#parameters)󠁿

 `$variation`arrayrequired

Theme.json shaped style variation object.

`$scope`stringrequired

Scope to check e.g. theme, block etc.

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

 bool Whether the supplied style variation matches the provided scope.

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

    ```php
    private static function style_variation_has_scope( $variation, $scope ) {
    	if ( 'block' === $scope ) {
    		return isset( $variation['blockTypes'] );
    	}

    	if ( 'theme' === $scope ) {
    		return ! isset( $variation['blockTypes'] );
    	}

    	return false;
    }
    ```

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

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

| Version | Description | 
| [6.6.0](https://developer.wordpress.org/reference/since/6.6.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_json_resolver%2Fstyle_variation_has_scope%2F)
before being able to contribute a note or feedback.