How To Enqueue External Scripts On WordPress

10 February 2021
2 min read

When building a WordPress website, there are many occasions when we need to link to external scripts, for example:

  • CDNs for fonts (font-awesome, Adobe Typekit, Google Fonts)
  • Links for plugin scripts or 3rd party embedded scripts
  • Higher-level features like Google Maps

It is always easy to hardcode the link into the header.php file, however, that is not best practice when it comes to WordPress. WordPress comes with a powerful enqueue feature that comes equipped with version control, dependencies and other features.

Paste the above script into your functions.php (or ditch the function, and just copy the enqueue line if you already have an enqueue function), change the URL, and you're done.

You can also set dependencies if you wish — for more information, please visit the official WordPress documentation.

Unsure of where to insert this? Don’t want to break anything? Our team of WordPress developers in Singapore can accomplish this job for you safely and efficiently. We are highly experienced in WordPress and web development and are equipped in solving any issues you might be facing.

Do note that this guide is purely for enqueuing external scripts on WordPress. For other WordPress functions, please contact us if you need help. Our team of WordPress developers in Singapore will be happy to assist you!

RELATED ARTICLES

Thumbnail
Thumbnail
Thumbnail

Have queries or need some advice?

FOR LIGHTNING-QUICK CORRESPONDENCE, DROP US A
WHATSAPP MESSAGE OR EMAIL US