• Resolved babyewok

    (@babyewok)


    I am trying to dequeue google fonts so that I can handle them differently. I tried

    function sydney_dequeue_google_fonts() {
           wp_dequeue_style( 'sydney-fonts' );
    }
    add_action( 'wp_enqueue_scripts', 'sydney_dequeue_google_fonts' ); 

    as suggested here: https://forums.athemes.com/t/local-installation-of-google-fonts/30523/4

    but
    <link rel="stylesheet" id="sydney-fonts-css" href="https://fonts.googleapis.com/css?family=Open+Sans%3A400%2C600%7CPoppins%3A400%2C500%2C600%2C700" type="text/css" media="all">
    still seems to be added to the header.

    Am I missing something?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter babyewok

    (@babyewok)

    Interesting – fixed by changing it to this:

    function sydney_dequeue_google_fonts() {
           wp_dequeue_style( 'sydney-fonts' );
    }
    add_action( 'wp_enqueue_scripts', 'sydney_dequeue_google_fonts', 999 ); 

    If anyone could enlighten me as to why this made a difference, I’d appreciate it!

    The value you added (999) is the priority. In your example the higher the better.

    In your first version, your code was probably being overridden by something with higher priority. In your second version, you fixed that.

    Thread Starter babyewok

    (@babyewok)

    @dannycooper thanks for the explanation! I imagined it must be something like that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Dequeue Google Fonts Sydney Pro’ is closed to new replies.