require_if_theme_supports( string $feature, string $include )

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

Parameters

$feature

(string) (Required) The feature being checked. See add_theme_support() for the list of possible values.

$include

(string) (Required) Path to the file.

Return

(bool) True if the current theme supports the supplied feature, false otherwise.

Source

File: wp-includes/theme.php

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

Changelog

Version Description
2.9.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/require_if_theme_supports