# Theme support for Soil 3.x and 4.x?

**URL:** https://discourse.roots.io/t/theme-support-for-soil-3-x-and-4-x/21322
**Category:** sage
**Tags:** soil, webpack
**Created:** 2021-08-24T11:49:50Z
**Posts:** 5

## Post 1 by @strarsis — 2021-08-24T11:49:50Z

Soil 4.x uses a new theme support key and options array.  
Should a theme that supported Soil 3.x (as Sage 9.x) should replace the legacy theme supports or also append the new ones for Soil 4.x?  
How hard is it to update from previous Soil to recent Soil? The soil licenses are valid for all current and future releases of Soil?

> [@Sage "9.1": Please test](https://discourse.roots.io/t/sage-9-1-please-test/20067/98):
>
> Alright, your observation is indeed correct. Soil now uses a different theme support key and an array for the options: You have to replace the existing Soil-related lines in Sage 9.x (and currently 9.1, I plan to fix that): /\*\* \* Enable features from Soil when plugin is activated \* for Soil 3.x \* @link https://roots.io/plugins/soil/ \*/ add\_theme\_support('soil-clean-up'); add\_theme\_support('soil-jquery-cdn'); add\_theme\_support('soil-nav-walker'); ad…

---

## Post 2 by @ben — 2021-08-26T16:29:32Z

> [@strarsis](#):
>
> Should a theme that supported Soil 3.x (as Sage 9.x) should replace the legacy theme supports or also append the new ones for Soil 4.x?

## Soil 3 to 4 upgrade path

Existing versions of Soil work by enabling features as such:

```
add_theme_support('soil-clean-up');
add_theme_support('soil-nav-walker');
add_theme_support('soil-nice-search');
add_theme_support('soil-relative-urls');
```

This has been changed to support two different ways of enabling Soil features. The first one is a similar approach:

```
add_theme_support('soil', 'clean-up');
add_theme_support('soil', 'nav-walker');
add_theme_support('soil', 'nice-search');
add_theme_support('soil', 'relative-urls');
```

Alternatively, you can setup all modules at once, along with defining options for some:

```
add_action('after_setup_theme', function() {
    add_theme_support('soil', [
        'clean-up',
        'disable-rest-api',
        'disable-asset-versioning',
        'disable-trackbacks',
        'google-analytics' => [
            'should_load' => true,
            'google_analytics_id' => 'UA-XXXYYY',
            'anonymize_ip' => true,
        ],
        'js-to-footer',
        'nav-walker',
        'nice-search',
        'relative-urls'
    ]);
});
```

> [@strarsis](#):
>
> The soil licenses are valid for all current and future releases of Soil?

Yes :+1:

---

## Post 3 by @strarsis — 2021-08-26T16:50:15Z

Concerning the Sage 9.x update branch: Should the theme supports added for Soil 3.x and Soil 4.x?  
Or just Soil 4.x as updating to latest Soil is always relatively trivial and free?

---

## Post 4 by @ben — 2021-08-27T15:15:49Z

I’d say use the Soil 4 syntax :+1:

---

## Post 5 by @strarsis — 2021-08-27T16:02:59Z

[Changed in the Sage 9.1 update branch.](https://github.com/roots/sage/pull/2607/commits/6d40a61bbbaf447998bba9026f6d30c5c4b868e9)
