6 Things I Learned From My First Public WordPress Plugin

wordpress-plugins-lessonsThis post may be a little overdue, considering I just released my second WordPress plugin, where I
learned a lot of more advanced plugin development techniques like using serialized data and using tabs to separate your admin sections. Much like a kiss though, you never forget your first plugin or the lessons you learn from it. You may make a lot of mistakes. Sometimes those mistakes are embarrassingly obvious, and sometimes you only realize you could have done better after several more attempts. In this post, I’m going to make sure you don’t end up making the same mistakes I did. Err – plugin mistakes. You’re on your own with your kissing mistakes.

The Plugin

Every plugin is different and not every situation is the same. To fully appreciate the lessons below, you should know the context.

My first plugin is called Casper’s Flyin Call-to-Action. In a nutshell, it adds a bar to the side or to the bottom of your screen which slides open to reveal a larger area, perhaps a sign-up form or announcement. It was very important for me to include a few things in this plugin to give users the best possible experience, aside from the not-always-so-obvious fact that it had to work and be responsive.

  1. Editable Color Palette
  2. Editable Title Bar (the bar that sits on the side of your screen)
  3. Editable Content Area (where you could put your sign-up form or announcement)

1 and 2 were no problem after I read through the WordPress Codex, and neither, I thought, was 3. I was wrong.


One of the best features about WordPress is the use of shortcodes, which gives non-developers tons of power. As such, I wanted my users to be able to use shortcodes in the content section of the plugin options. It was especially important if I wanted users to be able to include forms.

The Mistake:

I fatally assumed that any WordPress WYSIWYG (What You See Is What You Get) would automatically parse a user’s shortcode. It doesn’t.

The Solution:

In the HTML output, I was writing echo get_option('option_name'); when I should have been writing echo do_shortcode( get_option('option_name') );. The do_shortcode() function is what tells WordPress to parse any shortcodes present in the value of the option.


If you’re not already enqueuing your scripts and styles, you should be. It prevents conflicts with other plugins and themes, enhances performance and SEO, helps manage dependencies, etc. Perhaps most importantly, it prevents duplicate scripts/styles from being loaded. For example, if your plugin uses Font Awesome, and the theme you are running is also using Font Awesome, wp_enqueue_script will recognize the duplicate and only require the browser to download it once.

The Mistake:

Where I went wrong was assuming that jQuery was installed and running by default in WordPress itself. Since jQuery was already enqueued in every theme I’ve ever worked with, I never stopped to think it was in the theme and not WordPress itself.

Imagine my shock, shame, and disappointment when I received my only one star review telling me the plugin didn’t work. It turns out, his theme just didn’t have jQuery installed!

The Solution:

Once I realized there was a problem, it was a very simple solution. All I needed was to add wp_enqueue_script(‘jquery’) into the plugin’s script enqueue function. If you don’t have an enqueue function already, check out the documentation.

Media Button Support

There are dozens of plugins that add buttons to the WordPress WYSIWYG that allow you to easily and seamlessly add items and objects into your content. The most well-known, of course, is WordPress’s default Add Media, which lets you drop in images from your Media Library or your computer. Two of our most common plugins also add a button, which you can see below.

WordPress Media Buttons

Knowing this, I knew it would be important to support these buttons in my plugin’s WYSIWYG.

The Mistake:

Not a mistake, per se, but a realization: It turns out support for these buttons is not always guaranteed. It depends on how the other plugin coded their button. For example, Shortcodes Ultimate is tied to the media buttons, and so shows up by default whenever the media buttons do. Gravity Forms, however, is not.

Aside: Media buttons are enabled by default whenever you call wp_editor(), which is how you code the WordPress WYSIWYG.

The Solution:

Since my plugin was designed with Gravity Forms (or other form plugins) specifically in mind, it was important I had a working Gravity Forms media button. To include it, all you need to do is add the following filter to your plugin files:

/* Support for Gravity Forms Add Form Button */
function display_form_button_in_my_plugin( $is_post_edit_page ) {
 if ( isset( $_GET['page'] ) && $_GET['page'] == 'name-of-plugin-page' ) {
 return true;
 return $is_post_edit_page;
add_filter( 'gform_display_add_form_button', 'display_form_button_in_my_plugin' );

Replace display_form_button_in_my_plugin with something unique to your plugin. Additionally, replace name-of-plugin-page with the name of the page you want to add support to. You can find this page name when you’re on your plugin’s admin page. Look in the URL for something that looks like the following:


Ease of Access

One of the most frustrating things sometimes when working with plugins, is trying to find the settings page! Is it under Appearance? Settings? Tools? Does it have it’s own menu item? Like any good web developer, one of my primary concerns with developing is user experience. What good is your plugin if your users can’t get to the settings?

The Mistake:

On an early iteration of my plugin, I made a note in the description on the plugins page, that told users where it was. It was at least somewhat effective, but still forced the users to click their way there instead of bringing them there directly.

The Solution:

One of the solutions I found was to add a Settings link right to the plugin links on the plugin page, as seen below.

Plugin Settings Link

/* Add Settings Link to Plugin Page */
function plugin_settings_link($links, $file) {
 if ( $file == 'plugin-folder-name/plugin-file-name.php' ) {
 /* Insert the link at the end*/
 $links['settings'] = sprintf( '<a href="%s"> %s </a>', admin_url( 'options-general.php?page=pluginpage' ), __( 'Settings', 'plugin_domain' ) );
 return $links;
add_filter('plugin_action_links', 'plugin_settings_link', 10, 2);

Just like before, replace plugin-folder-name/plugin-file-name.php with the appropriate items for your plugin. Replace function name, plugin_settings_link, with your unique plugin name, as well as the admin_url page. That will add the Gravity Forms media button to your plugin!

Search Optimization

WordPress has thousands of plugins and it’s own search engine to sort and filter through them. I haven’t cracked the SEO for the WordPress Plugin Directory, nor am I able to find much documentation or tips for it, but I have learned a few do’s and do not’s.

The Mistake:

I tried to stuff my plugin full of all sorts of terms that I thought users might be searching for, including minor variations like making a word a plural or including ‘the.’

The Solution:

After attempting to submit the plugin in this form, the feedback I received from the WordPress reviewers is that they do not allow more than twelve terms or phrases. Choose carefully!

If anyone has a good guide or documentation for this topic, please share it in the comments below.

Support and Your Plugin’s Community

Each plugin that you host through WordPress is given its own page. Each of these pages has it’s own review, comment, and support section.

The Mistake:

If your plugin is being used, which I hope it is, people will leave you feedback on your plugin page. Even though you’re forced to make a WordPress account to upload a plugin, by default it does not notify you when someone leaves a review or support question.

The Solution:

One solution – the one I was doing for awhile – was to frequently check the page for updates. Recently, however, I learned you could opt into email updates.

Just go to the Support tab, scroll down a little, and you’ll see a link to the RSS feed as well as the option to ‘Subscribe’ or ‘Unsubscribe from Emails for this Plugin,’ depending on your current preferences.RSS-plugin-support

All you need to do is click ‘Subscribe,’ and you’ll never miss feedback again! Now if someone tells you your plugin is broken, you can fix it immediately.

The six items above were things I learned the hard way after publishing my first WordPress plugin. Some of them are minor things that may or may not affect you depending on what you’re trying to do, but all of them were things I wish I’d known earlier.

If you have any further information about anything discussed above, or just want to share some of your own discoveries, please leave them in the comments below! Or you can say hello to me on twitter at @SirCaseyJames.



Related Posts


There are currenty one response.

Shivam Sahu
January 6, 2018

Great article, and while I knew most of these tips there are a still a few I didn’t know about. One thing I see on some new (and maybe even older) WordPress site is people don’t disable/remove the meta admin widget from their sidebar. No reader/viewer/client/customer, etc needs to see a link for you to log into your WordPress dashboard when they got to your site. That tab is completely useless (just go to yoursite.com/wp-admin) and should be removed as soon as your site is active.


Leave a Reply

Your email address will not be published. Required fields are marked *

Request A Quote
Let's take your business to the next level. Fill out the form below to get started!
  • This field is for validation purposes and should be left unchanged.