require_if_theme_supports

The timeline below displays how wordpress function require_if_theme_supports has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Checks a theme's support for a given feature before loading the functions which implement it.
 *
 * @since 2.9.0
 *
 * @param string $feature The feature being checked. See add_theme_support() for the list
 *                        of possible values.
 * @param string $file    Path to the file.
 * @return bool True if the active theme supports the supplied feature, false otherwise.
 */
function require_if_theme_supports($feature, $file)
{
    if (current_theme_supports($feature)) {
        require $file;
        return true;
    }
    return false;
}

WordPress Version: 6.1

/**
 * Checks a theme's support for a given feature before loading the functions which implement it.
 *
 * @since 2.9.0
 *
 * @param string $feature The feature being checked. See add_theme_support() for the list
 *                        of possible values.
 * @param string $include Path to the file.
 * @return bool True if the active theme supports the supplied feature, false otherwise.
 */
function require_if_theme_supports($feature, $include)
{
    if (current_theme_supports($feature)) {
        require $include;
        return true;
    }
    return false;
}

WordPress Version: 5.5

/**
 * Checks a theme's support for a given feature before loading the functions which implement it.
 *
 * @since 2.9.0
 *
 * @param string $feature The feature being checked. See add_theme_support() for the list
 *                        of possible values.
 * @param string $include Path to the file.
 * @return bool True if the current theme supports the supplied feature, false otherwise.
 */
function require_if_theme_supports($feature, $include)
{
    if (current_theme_supports($feature)) {
        require $include;
        return true;
    }
    return false;
}

WordPress Version: 3.9

/**
 * Checks a theme's support for a given feature before loading the functions which implement it.
 *
 * @since 2.9.0
 *
 * @param string $feature The feature being checked.
 * @param string $include Path to the file.
 * @return bool True if the current theme supports the supplied feature, false otherwise.
 */
function require_if_theme_supports($feature, $include)
{
    if (current_theme_supports($feature)) {
        require $include;
        return true;
    }
    return false;
}

WordPress Version: 3.7

/**
 * Checks a theme's support for a given feature before loading the functions which implement it.
 *
 * @since 2.9.0
 * @param string $feature the feature being checked
 * @param string $include the file containing the functions that implement the feature
 */
function require_if_theme_supports($feature, $include)
{
    if (current_theme_supports($feature)) {
        require $include;
    }
}