Title: wp_is_theme_directory_ignored
Published: May 25, 2022
Last modified: May 20, 2026

---

# wp_is_theme_directory_ignored( string $path ): bool

## In this article

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

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

Determines whether a theme directory should be ignored during export.

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

 `$path`stringrequired

The path of the file in the theme.

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

 bool Whether this file is in an ignored directory.

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

    ```php
    function wp_is_theme_directory_ignored( $path ) {
    	$directories_to_ignore = array( '.DS_Store', '.svn', '.git', '.hg', '.bzr', 'node_modules', 'vendor' );

    	foreach ( $directories_to_ignore as $directory ) {
    		if ( str_starts_with( $path, $directory ) ) {
    			return true;
    		}
    	}

    	return false;
    }
    ```

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

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

| Used by | Description | 
| [wp_generate_block_templates_export_file()](https://developer.wordpress.org/reference/functions/wp_generate_block_templates_export_file/)`wp-includes/block-template-utils.php` |

Creates an export of the current templates and template parts from the site editor at the specified path in a ZIP file.

  |

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

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

## User Contributed Notes

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