Title: WP_Block_Metadata_Registry::get_plugin_dir
Published: November 13, 2024

---

# WP_Block_Metadata_Registry::get_plugin_dir(): string

## In this article

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

[ Back to top](https://developer.wordpress.org/reference/classes/wp_block_metadata_registry/get_plugin_dir/?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.

Gets the normalized WordPress plugin directory path.

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

 string The normalized WordPress plugin directory path.

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

    ```php
    /**
     * Default identifier function to determine the block identifier from a given path.
     *
     * This function extracts the block identifier from the path:
     * - For 'block.json' files, it uses the parent directory name.
     * - For directories, it uses the directory name itself.
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-block-metadata-registry.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-wp-block-metadata-registry.php#L267)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-block-metadata-registry.php#L267-L272)

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

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

## User Contributed Notes

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