I'm trying to enqueue a typekit on my WP site in a function using code below:

 * TypeKit Fonts
 * @since Theme 1.0
function theme_typekit() {
    wp_enqueue_script( 'theme_typekit', '//use.typekit.net/xxxxxxx.js');
add_action( 'wp_enqueue_scripts', 'theme_typekit' );

function theme_typekit_inline() {
  if ( wp_script_is( 'theme_typekit', 'done' ) ) { ?>
    <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<?php }
add_action( 'wp_head', 'theme_typekit_inline' );

Code appears to be working fine, however when url called on frontend it's showing 404 in console for link, https://use.typekit.net/xxxxxxx.js

Any idea why not found? Note, I'm using a valid typekit code on my end.

  • 1
    Looks good to me. Did you publish your font kit? Can you browse the file: https://use.typekit.net/xxxxxxx.js?
    – Sven
    Commented May 4, 2016 at 22:35
  • 1
    Yup...exactly the issue. I didn't publish, duh! It's working fine now. Thanks for response.
    – frshjb373
    Commented May 4, 2016 at 22:35
  • Glad I could help :) I also added my comment as an answer so you can mark this question as solved ;)
    – Sven
    Commented May 4, 2016 at 22:52

1 Answer 1


As mentioned in the comments, your code snippet is working fine. Nevertheless the font kit has to be published within the Kit Editor:

  1. Login to your Typekit account
  2. Locate the Kit Editor (see: https://typekit.com/kit_editor/kits/xxxxxxx)
  3. Click the Publish button (bottom right)

You may also consider using the new embed code provided by Typekit:

<script>try{Typekit.load({ async: true });}catch(e){}</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.