Home Forums Pro Themes Travel Eye Pro Can I stop theme_google_fonts from autoloading?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #210186
    Paul614724
    Participant

    The site health status of my site identifies a critical issue “Your site has 584 autoloaded options (size: 1 MB) in the options table, which could cause your site to be slow.”

    AAA Option Optimizer plugin identifies 7 pages of unused, but autoloaded options, most of them are tiny in size, but theme_google_fonts alone uses 850.69KB.

    Can I safely remove the autoload option for theme_google_fonts without damaging the appearance of my site?

    FWI I just updated the travel eye pro theme from 2.2 to 2.7

    Thanks for any help you can give, I’m pretty clueless about this stuff.

    #210195
    Psink
    Keymaster

    @paul614724, Yes, you can disable autoload option for theme_google_fonts.

    Please add this code to your site. You can use code snippet plugin WP Codeto cadd this code

    add_action('init', function () {
        global $wpdb;
    
        $option_name = 'theme_google_fonts';
    
        // Check if option exists and is set to autoload
        $autoload_value = $wpdb->get_var(
            $wpdb->prepare(
                "SELECT autoload FROM {$wpdb->options} WHERE option_name = %s",
                $option_name
            )
        );
    
        if ($autoload_value === 'yes') {
            $wpdb->query(
                $wpdb->prepare(
                    "UPDATE {$wpdb->options} SET autoload = 'no' WHERE option_name = %s",
                    $option_name
                )
            );
        }
    });
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.