Title: wp_theme_get_element_class_name
Published: November 2, 2022
Last modified: February 24, 2026

---

# wp_theme_get_element_class_name( string $element ): string

## In this article

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

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

Given an element name, returns a class name.

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

Alias of [WP_Theme_JSON::get_element_class_name()](https://developer.wordpress.org/reference/classes/wp_theme_json/get_element_class_name/).

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

 `$element`stringrequired

The name of the element.

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

 string The name of the class.

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

    ```php
    function wp_theme_get_element_class_name( $element ) {
    	return WP_Theme_JSON::get_element_class_name( $element );
    }
    ```

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

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

| Uses | Description | 
| [WP_Theme_JSON::get_element_class_name()](https://developer.wordpress.org/reference/classes/wp_theme_json/get_element_class_name/)`wp-includes/class-wp-theme-json.php` |

Returns a class name by an element name.

  |

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

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

## User Contributed Notes

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