W3cubDocs

/WordPress

WP_Block_Metadata_Registry::has_metadata( string $file_or_folder ): bool

Checks if metadata exists for a given block name in a specific collection.

Parameters

$file_or_folderstringrequired
The path to the file or folder containing the block metadata.

Return

bool True if metadata exists for the block, false otherwise.

Source

public static function has_metadata( $file_or_folder ) {
	return null !== self::get_metadata( $file_or_folder );
}

Changelog

Version Description
6.7.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_block_metadata_registry/has_metadata