How to Add Custom JavaScript to WordPress

How to Add Custom JavaScript to WordPress

Last Updated November 6th, 2023

White Label Logo This post is brought to you by White Label for WordPress. Customize the WordPress admin and make life easier for you and your clients.

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 so you can have a WordPress syntax highlighter, 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 product was first released by its developer in December of 2015. It is now on version 3.46 and last underwent a change on February 1st, 2024. The latest release operates on WordPress 6.5.2 and requires at least PHP 5.2.4 to function on your server. This plugin is presently running on over 600,000 WordPress websites. It has had over 6,776,670 downloads. There have been 3 help 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 customers who left a review found Simple Custom CSS and JS to be great.

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 initially published by its creator in April of 2015. It is actively on version 1.2.3 and last saw a revision on February 24th, 2023. The latest version operates on WordPress 6.1.6. This plugin is currently operating on over 10,000 WordPress websites. It has had over 110,170 downloads. There have not been many help requests from customers. Reviews for TC Custom JavaScript are very positive. Many of the customers who left a review found this plugin to be great.

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 product was initially published by its creator in February of 2018. It is currently on version 3.5.1 and last had a revision on March 7th, 2024. The newest release runs on WordPress 6.4.4 and requires at least PHP 7.4 to operate on your server. This plugin is currently running on over 10,000 WordPress websites. It has had over 226,880 downloads. There have not been many support requests from customers. Reviews for WP Coder – Powerful HTML, CSS, JS and PHP Injection are very positive. Many of the end-users who left a review found this plugin 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 originally released by its creator in September of 2015. It is now on version 1.4.0 and last saw an update on October 25th, 2016. The newest release runs on WordPress 4.6.28. This plugin is currently working on over 2,000 WordPress sites. It has had over 67,830 downloads. There have not been many assistance requests from customers. 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 originally published by its creator in November of 2016. It is currently on version 1.0.5 and last had a change on March 13th, 2020. The most recent release works on WordPress 5.3.17. This plugin is currently functioning on over 700 WordPress sites. It has had over 11,900 downloads. There have not been many assistance requests from end-users. Reviews for this plugin are very positive. Many of the end-users who left a piece of feedback 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 product was initially released by its creator in October of 2019. It is actively on version 1.0.8 and last had an update on April 18th, 2024. The newest version works on WordPress 6.5.2 and requires at least PHP 7.3 to work on your server. This plugin is actively working on over 100 WordPress websites. It has had over 2,830 downloads. There have not been many assistance requests from end-users. Reviews for this plugin are very positive. Many of the users who left an evaluation found Easy Custom Code (LESS/CSS/JS) – Live editing 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 product was originally released by its owner in September of 2017. It is currently on version 1.0.0 and last experienced a change on September 5th, 2017. The latest release operates on WordPress 4.8.24. This plugin is currently operating on over 30 WordPress sites. It has had over 1,060 downloads. There have not been many support requests from customers. JS Injector does not have any reviews. It’s difficult 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

How to Add WordPress LDAP Authentication Using a Plugin

Are you interesting in adding LDAP authentication to your WordPress website? You’ll need the help of a WordPress LDAP plugin to get started.

WordPress IP Address Plugins to Block, Identify, and Find User Location

Check our list of WordPress IP address plugins that you can use to identify visitors by their location and control how they access content.