require_if_theme_supports()WP 2.9.0

Checks a theme's support for a given feature before loading the functions which implement it.

No Hooks.

Return

true|false. True if the active theme supports the supplied feature, false otherwise.

Usage

require_if_theme_supports( $feature, $file );
$feature(string) (required)
The feature being checked. See add_theme_support() for the list of possible values.
$file(string) (required)
Path to the file.

Changelog

Since 2.9.0 Introduced.

require_if_theme_supports() code WP 6.5.2

function require_if_theme_supports( $feature, $file ) {
	if ( current_theme_supports( $feature ) ) {
		require $file;
		return true;
	}
	return false;
}