How to Add Custom JavaScript to WordPress

How to Add Custom JavaScript to WordPress

Last Updated December 12, 2022

Often, WordPress developers work on client projects with themes and plugins that require a bit of extra code. Typically, this involves writing some custom JavaScript to make a theme work a bit differently or to improve a plugin’s interface. WordPress, unfortunately, doesn’t have a default way to add custom JavaScript to a site. Thankfully, the WordPress plugin community has stepped up to the plate. There are quite a few really great plugins that let you add custom JavaScript to WordPress. We’re going to take a look at some of those here today.


Popular Plugins to Add Custom JavaScript to WordPress

All of these plugins are available at WordPress.org for download right now. You can also, if you prefer, install and activate them directly inside of the WordPress admin. Many of these plugins offer additional features as well as the ability to add custom JavaScript to WordPress. We’ve taken the time to explain those extra features as well in case you might find them useful in your WordPress projects.

Simple Custom CSS and JS

Simple Custom CSS and JS

The Simple Custom CSS and JS plugin lets you easily change your WordPress website’s appearance by adding custom CSS and JavaScript code without modifying your theme or plugin files. The plugin’s key features include a text editor with syntax highlighting, adding CSS or JavaScript to the frontend or the admin side, adding as many code snippets as you want, and keeping your changes even when you change the theme. This makes Simple Custom CSS and JS perfect for adding custom CSS and JavaScript tweaks to your site.

Plugin Details

This plugin was originally published by its developer in December of 2015. It is now on version 3.42 and last underwent an update on January 17th, 2023. The latest release operates on WordPress 6.2 and requires at least PHP 5.2.4 to work on your server. This plugin is now operating on over 500,000 WordPress websites. It has had over 5,125,110 downloads. There have been 3 assistance requests with a 100% response rate. Simple Custom CSS and JS is well supported by its creator. Reviews for this plugin are very positive. Many of the end-users who left a review found this plugin to be excellent.

Security Issues and Vulnerabilities

There has been one recorded security or vulnerability issue with Simple Custom CSS and JS. The security problem was fixed and here are the details.

DateDescriptionFixed?
7/24/17Cross-Site Scripting
This was a medium concern issue that was fixed in version 3.3.
Yes
TC Custom JavaScript

TC Custom JavaScript

The TC Custom JavaScript plugin enables website admins to add custom JavaScript to their sites from a professional editor in the WordPress admin. This plugin is brutally minimalist. If you want a simple code editor, without a lot of extra frills or features, then TC Custom JavaScript is right for you. For developers seeking more features and, maybe, a nicer interface it wouldn’t hurt to review the other plugins to add custom JavaScript to WordPress on our list.

Plugin Details

This piece of software was first released by its developer in April of 2015. It is currently on version 1.2.3 and last had a change on February 23rd, 2021. The most recent edition works on WordPress 5.6.10. This plugin is now working on over 10,000 WordPress sites. It has had over 98,960 downloads. There have not been many assistance requests from end-users. Reviews for this plugin are very positive. Many of the users who left a review found this plugin to be useful.

Security Issues and Vulnerabilities

There has been one recorded security or vulnerability issue with TC Custom JavaScript. The security problem was fixed and here are the details.

DateDescriptionFixed?
7/21/20Unauthenticated Stored Cross-Site Scripting
This was a high concern issue that was fixed in version 1.2.2.
Yes
WP Coder

WP Coder

Add custom HTML, JavaScript, and CSS codes to your WordPress site with WP Coder. You can place any element on the website that you create with scripts and styles to add functionality to the website or make it look beautiful. For example, you can add a pop-up window notifying users of new updates when they visit your website. The plugin’s notable features include ease of use, third-party libraries connection, and shortcode insertions into HTML code.

Plugin Details

This piece of software was originally published by its owner in February of 2018. It is currently on version 2.5.4 and last experienced a change on January 10th, 2023. The latest release functions on WordPress 6.0.3 and requires at least PHP 5.3 to function on your server. This plugin is actively functioning on over 10,000 WordPress sites. It has had over 116,480 downloads. There have not been many assistance requests from users. Reviews for WP Coder – add custom html, css and js code are very positive. Many of the users who left a review found WP Coder – add custom html, css and js code to be wonderful.

Security Issues and Vulnerabilities

There have been 2 recorded security or vulnerability issues with WP Coder. All of those security problems have been fixed. Here are the details:

DateDescriptionFixed?
7/26/22Cross-Site Request Forgery
This was a high concern issue that was fixed in version 2.5.2.
Yes
12/5/21Remote File Inclusion leading to Remote Code Execution via Cross-Site Request Forgery
This was a high concern issue that was fixed in version 2.5.1.
Yes
Custom CSS

Custom CSS

As the name suggests, the Custom CSS plugin enables you to create custom CSS to add to a WordPress site. But don’t let the name fool you. This plugin supports JavaScript code snippets as well. You just need to write your CSS and JavaScript code inside the ACE editor and specify where you want it to appear. That’s it! The plugin provides an excellent way to write CSS adjustments and custom JS without any hassles.

Plugin Details

This plugin was first released by its owner in September of 2015. It is currently on version 1.4.0 and last underwent a revision on October 25th, 2016. The latest edition runs on WordPress 4.6.25. This plugin is presently functioning on over 3,000 WordPress websites. It has had over 67,140 downloads. There have not been many assistance requests from end-users. Users rate this plugin as average.

Live Custom CSS JS Code Editor

Live Custom CSS JS Code Editor

Easily add custom CSS, JavaScript, header, and footer code to your WordPress site with the Live Custom CSS JS Code Editor plugin. Thanks to the WordPress Live Customizer, you can see your changes in real-time. The plugin’s key features include support for custom CSS and JavaScript code, header and footer code, real-time changes, a built-in syntax highlighter, and support for up to four million lines of code. Simply go to your WordPress dashboard, head to customize, then use the live code editor to get started.

Plugin Details

This plugin was initially released by its developer in November of 2016. It is currently on version 1.0.5 and last underwent a change on March 13th, 2020. The newest update operates on WordPress 5.3.14. This plugin is actively working on over 900 WordPress sites. It has had over 11,300 downloads. There have not been many assistance requests from customers. Reviews for Live Custom CSS JS Code Editor are very positive. Many of the users who left a review found this plugin to be worthwhile.

Easy Custom Code

Easy Custom Code

Easy Custom Code lets you add custom LESS, CSS, and JavaScript code and external resources (stylesheets and scripts) to your WordPress website using the core WP Customizer. Simply add your JavaScript or LESS/CSS code and then let the plugin work its magic. There is no need to create a child theme or any other files in your current theme. The plugin’s key features include support for unlimited external stylesheets, custom JavaScript code, and custom HTML code.

Plugin Details

This piece of software was first published by its owner in October of 2019. It is presently on version 1.0.5 and last experienced a change on June 14th, 2022. The most recent version runs on WordPress 6.0.3 and requires at least PHP 7.0 to run on your server. This plugin is actively functioning on over 100 WordPress sites. It has had over 2,010 downloads. There have not been many assistance requests from customers. Reviews for Easy Custom Code (LESS/CSS/JS) – Live editing are very positive. Many of the end-users who left a piece of feedback found this plugin to be useful.

Premium Version

You can purchase the plugin’s premium version to access additional features like minified CSS code and a maximized code editor. It will cost you €29/year. The premium version provides unlimited website usage for a lifetime with support and updates for one year. A 30-day money-back guarantee protects you if you are unsatisfied with your purchase.

JS Injector

JS Injector

JS Injector allows you to add custom JavaScript into a selected place of your WordPress website in the simplest possible way. The plugin’s noteworthy features include support for five sections, including the admin panel and password recovery page, the option to place the JavaScript code at the header and footer of the page, a mobile-optimized interface, and compatibility with old and new WordPress versions. The plugin doesn’t require technical skills, is extremely easy to manage, and is 100% ad-free.

Plugin Details

This plugin was initially published by its developer in September of 2017. It is actively on version 1.0.0 and last experienced a change on September 5th, 2017. The newest edition runs on WordPress 4.8.21. This plugin is currently functioning on over 30 WordPress sites. It has had over 850 downloads. There have not been many assistance requests from users. JS Injector does not have any reviews. It’s hard to tell what the WordPress community thinks about it yet.

What’s the Best Plugin to Add Custom JavaScript to WordPress?

WordPress Core doesn’t support adding your own JavaScript. Directly editing themes or making small plugins is a hassle. So, in the end, using a plugin to add custom JavaScript to WordPress is an easier solution. We recommend you give a few of these plugins a try before making a final decision. They all offer the ability to add your own JavaScript to WordPress. Many also have additional features, like support for custom CSS, that might be helpful to you in different situations. In the end, we think one of these custom JavaScript plugins will be the right fit for you and your project’s needs.

Check out our White Label WordPress plugin before you go. Our plugin lets you customize and rebrand the WordPress admin experience for your clients. Do your clients find the admin confusing? Hide and rename menus to make things easier for them to understand and navigate. Match the branding of your client with WordPress by changing the look of the login page and adding their logos throughout the admin. You can use White Label to create custom dashboard elements, change the default behavior of many WordPress features, and much more. Take a look at the full feature list here on our site.


Related Posts from Our WordPress Blog

WordPress Dropbox Plugins to Store and Share Files Effectively

Connecting your Dropbox account to your WordPress site can be a great way to handle files. Check out our list of WordPress Dropbox plugins.

The Best WordPress Caching Plugins for Slow Websites

Keeping a client’s WordPress website loading fast is incredibly important. Check out our list of the best WordPress caching plugins available today.