How To Add A Custom Button To WordPress Quicktags

Recently, I posted an article about where I explained you how to add a custom button to WordPress’ TinyMCE editor, which required us to create a .js file as well. Here I’ll show you how to add a custom button to WordPress quicktags, which is also known as the text editor and the html editor. This one is really easy.

WordPress’ Quicktags API is quite simple. Adding a simple script to the post editor footer will do the job. Here’s an example.

The following code will add paragraph button, horizontal line button and preformatted text button to the quicktags. Drop the following code into your current theme’s functions.php file:

Just like this, you can also add a button for your shortcode to the plain text editor:

Pretty simple, right?