Soil Plugin - Not seeing any changes after install

I’ve just purchased and downloaded the soil plugin, and tried installing it on the Sage 10 theme. I can install and activate it without issue, but whether the plugin is activated or not, I do not see any improvements in the markup. For example I still see script tags in the head and early in the body despite having ‘js-to-footer’ enabled. I have do not see any google analytics injected, nor am I prevented from accessing the REST api by simply firing a get request to http://sage.test/wp-json/wp/v2/posts

I have added the following to the themes/sage/app/setup.php:

add_action('after_setup_theme', function () {
    /**
     * Enable features from the Soil plugin if activated.
     */
    add_theme_support('soil', [
        'clean-up', // Cleaner WordPress markup
        'disable-rest-api', // Disable REST API
        'disable-asset-versioning', // Remove asset versioning
        'disable-trackbacks', // Disable trackbacks
        'google-analytics' => 'UA-XXXXX-Y', // Google Analytics
        'js-to-footer', // Move JS to footer
        'nav-walker', // Clean up nav menu markup
        'nice-search', // Redirect /?s=query to /search/query
        'relative-urls', // Convert absolute URLs to relative URLs
    ]);
});

Am I misunderstanding something in the installation and setup process?

Hm, Sage already adds theme support for the soil plugin.

This may also be interesting:
https://discourse.roots.io/t/theme-support-for-soil-3-x-and-4-x/21322
https://discourse.roots.io/t/has-anyone-had-issues-with-product-filters-for-woocommerce/19455/9

1 Like

Aha - yes this would indeed be the issue. I had added the add_theme_support line as per the soil docs, not expecting it to already exist in sage since in my mind they are entirely independant, so the first instance was getting executed, but the one i added was not.

Yes. When add_theme_support is called multiple times for the same key (soil), the previous optional extra arguments are completely overridden by the new ones:

When multiple action handlers are (inadvertently) calling add_theme_support, the optional extra arguments of the action handler called last will be the one actually used.

This topic was automatically closed after 42 days. New replies are no longer allowed.