How to Add Custom JavaScript to WordPress
Last Updated November 6th, 2023
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
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 initially released by its owner in December of 2015. It is presently on version 3.48 and last had a change on September 24th, 2024. The most recent edition runs on WordPress 6.6.2 and requires at least PHP 5.2.4 to run on your server. This plugin is currently functioning on over 600,000 WordPress sites. It has had over 7,487,380 downloads. There have been 3 help requests with a 67% response rate. Simple Custom CSS and JS has ok support from its owner. Reviews for this plugin are very positive. Many of the customers who left a piece of feedback found Simple Custom CSS and JS to be worthwhile.
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.
Date | Description | Fixed? |
---|---|---|
7/24/17 | Cross-Site Scripting This was a medium concern issue that was fixed in version 3.3. | Yes |
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 creator in April of 2015. It is currently on version 1.2.3 and last underwent a change on February 24th, 2023. The newest edition functions on WordPress 6.1.7. This plugin is presently operating on over 10,000 WordPress websites. It has had over 111,850 downloads. There have not been many support requests from end-users. Reviews for TC Custom JavaScript are very positive. Many of the end-users who left a piece of feedback found this plugin to be excellent.
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.
Date | Description | Fixed? |
---|---|---|
7/21/20 | Unauthenticated Stored Cross-Site Scripting This was a high concern issue that was fixed in version 1.2.2. | Yes |
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 originally published by its owner in February of 2018. It is currently on version 3.5.1 and last underwent a revision on July 12th, 2024. The most recent edition runs on WordPress 6.6.2 and requires at least PHP 7.4 to work on your server. This plugin is actively running on over 10,000 WordPress sites. It has had over 239,540 downloads. There have not been many help requests from customers. Reviews for this plugin are very positive. Many of the customers who left a piece of feedback found WP Coder – Powerful HTML, CSS, JS and PHP Injection to be great.
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:
Date | Description | Fixed? |
---|---|---|
7/26/22 | Cross-Site Request Forgery This was a high concern issue that was fixed in version 2.5.2. | Yes |
12/5/21 | Remote 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
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 piece of software was originally released by its creator in September of 2015. It is presently on version 1.4.0 and last saw a change on October 25th, 2016. The most recent release works on WordPress 4.6.29. This plugin is now functioning on over 1,000 WordPress sites. It has had over 68,040 downloads. There have not been many support requests from users. Users score this plugin as average.
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 released by its creator in November of 2016. It is actively on version 1.0.5 and last had a change on March 13th, 2020. The most recent update works on WordPress 5.3.18. This plugin is now working on over 600 WordPress sites. It has had over 12,050 downloads. There have not been many assistance requests from users. Reviews for Live Custom CSS JS Code Editor are very positive. Many of the users who left a review found this plugin to be wonderful.
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 released by its creator in October of 2019. It is now on version 1.1.0 and last had a change on August 12th, 2024. The newest version works on WordPress 6.6.2 and requires at least PHP 7.3 to function on your server. This plugin is actively running on over 200 WordPress sites. It has had over 3,360 downloads. There have not been many support requests from customers. Reviews for this plugin are very positive. Many of the customers who left a review found Easy Custom Code (LESS/CSS/JS) – Live editing to be wonderful.
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 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 piece of software was initially published by its developer in September of 2017. It is now on version 1.0.0 and last had an update on September 5th, 2017. The newest update operates on WordPress 4.8.25. This plugin is now working on over 30 WordPress websites. It has had over 1,150 downloads. There have not been many support requests from users. JS Injector does not have any reviews. It’s not easy 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.