• Resolved aliakseyenkaihar

    (@aliakseyenkaihar)


    Is there any possibility to “delete” theme.json file within wp-includes directory? It renders styles and svg filters, set transients for colors I don’t need at all

    I do NOT have theme.json file in a theme root. Basically I don’t need block theme – maybe there is a way to disable all features related to it?

    Thanks

    • This topic was modified 2 years, 8 months ago by Yui. Reason: moved to fixing wordpress
Viewing 6 replies - 1 through 6 (of 6 total)
  • Gutenberg needs the theme.json in wp-includes to generate a CSS which gives styles for the editor. Without such styles the Editor might be not usable.

    If you want to override settings you have to add a custom theme.json in your theme-directory. Again: it is not possible to disable this.

    Here you’ll find more infos about the file: https://mkaz.blog/wordpress/using-theme-json-in-a-classic-theme/

    Thread Starter aliakseyenkaihar

    (@aliakseyenkaihar)

    Thanks that exactly what I needed. The default null settings has done the trick

    
    {
    	"version": 2,
    	"settings": {
            "color": {
    			"duotone": null,
    			"palette": null,
    			"gradients": null
            },
    		"typography": {
    			"fontSizes": null
    		}
        },
    	"styles": null,
    	"variables": null,
    	"presets": null
    }
    

    If you know is there any possibility to disable transients for these settings also? As I can see, when calling global styles, WordPress first delete and then set settings from theme.json into transients called _transient_global_styles_theme_name and _transient_timeout_global_styles_theme_name. That extra 4 slow queries. With setting above, I just set empty string as a transient. The only things I can see which may disable it are WP_DEBUG === true or SCRIPT_DEBUG === true or REST_REQUEST === true (file wp-includes/global-styles-and-settings.php line 88). But it is a production mode so WP_DEBUG is set to false. I tried to disable global styles registration but no luck so far

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Sort of thinking out loud on the disabling the transient, could maybe hook to the filter?

    https://github.com/WordPress/WordPress/blob/4cbad9a9aa655f6a1430887c3bd0732550e6d3f8/wp-includes/option.php#L843

    
    add_filter('pre_transient_global_styles_theme_name', '__return_true', 10 );
    
    • This reply was modified 2 years, 8 months ago by Jose Castaneda. Reason: use correct function name
    Thread Starter aliakseyenkaihar

    (@aliakseyenkaihar)

    Yes this filter worked thanks a lot)

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Yay!

    Glad to hear that works. I went spelunking on the code trying to recall what the hook was called for the transients.

    my website is creating issue suggest me theme

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Disable default theme.json’ is closed to new replies.