On this page
require_if_theme_supports( string $feature, string $include ): bool
Checks a theme’s support for a given feature before loading the functions which implement it.
Parameters
$featurestring Required-
The feature being checked. See add_theme_support() for the list of possible values.
More Arguments from add_theme_support( ... $feature )
The feature being added. Likely core values include:
'admin-bar''align-wide''automatic-feed-links''core-block-patterns''custom-background''custom-header''custom-line-height''custom-logo''customize-selective-refresh-widgets''custom-spacing''custom-units''dark-editor-style''disable-custom-colors''disable-custom-font-sizes''editor-color-palette''editor-gradient-presets''editor-font-sizes''editor-styles''featured-content''html5''menus''post-formats''post-thumbnails''responsive-embeds''starter-content''title-tag''wp-block-styles''widgets''widgets-block-editor'
$includestring Required-
Path to the file.
Return
bool True if the active theme supports the supplied feature, false otherwise.
Source
File: wp-includes/theme.php. View all references
function require_if_theme_supports( $feature, $include ) {
if ( current_theme_supports( $feature ) ) {
require $include;
return true;
}
return false;
}
Related
Uses
| Uses | Description |
|---|---|
| current_theme_supports() wp-includes/theme.php | Checks a theme’s support for a given feature. |
Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/require_if_theme_supports