How to dequeue google fonts

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How to dequeue google fonts

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 7 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9671
    luyendao
    luyendao
    Participant

    Hi there,

    I’m a bit of a performance nut, is there a way to dequeue the Lato and Open-Sans (Google fonts) loaded by the plugin.

    It seems to be loaded even if I use the theme inherited font. I tried adding this to functions.php, but it didn’t work. Any suggestions?

    add_action( 'wp_enqueue_scripts', function() {
      wp_dequeue_style( 'wpdreams-fonts' );
    }, 99 );

    Thanks!

    #9673
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    There is no working custom code to handle this, as the action is added via a singleton class which does not exist when the theme is initalized.

    You can however bypass it by editing the ajax-search-pro\includes\classes\actions\class-asp-customfonts.php file, by removing/disabling lines 23-24:

    $_cf = WD_ASP_Search_Shortcode::getInstance();
    $_cf->fonts();

    Just remove those lines, or put them into comments.

    ——–

    I’m going to add a filter to the upcoming release, so you won’t have to do this again after update. In the next update just use this code:

    add_filter('asp_custom_fonts', 'asp_null_css');
    function asp_null_css($css_arr) {
        return array();
    }
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.