How to Edit Your WordPress Plugin’s Code

Now that you’ve set up your WordPress site locally on your laptop so that you can easily code your plugin on the go, it’s time to add the features you want and start coding.

The code used by WordPress is English (mostly), sprinkled with a bit of math. While it might seem hard to understand right now, don’t worry about it too much. I was confused myself when I started coding. What really helped me though was just diving into the code and changing it, testing what worked and reversing the changes and trying again if it didn’t.

Edit Your Plugin Using WordPress’ Code Editor

The smart folks over at WordPress knew that site owner will want to mess around with their own site’s code. Rather than make it hard for them by forcing people to download, edit, then upload files, they just made editing possible right from the site’s admin area.

Here’s how to access that editor:

  1. Go to the admin area of your site and click Plugins, then click Editor. 
  2. Next to “Select plugin to edit:” at the top, choose the plugin you uploaded earlier then click the Select button.
  3. At the right, you will see the folders and files included in the plugin, arranged in a file browser like the one on your laptop.
  4. Inside the admin folder is a file starting with class-. If you followed along with my previous post, you’ll see that this is the same file you edited as before.
  5. Once you’re done editing, just click on Update File to save your changes.

NOTE: If you’re using InstantWP and getting an error saving your code, add the WP Editor plugin by Benjamin Rojas to fix that issue.

edit code using Coditor

Edit Code Using Coditor

There’s also a great plugin called Coditor which adds a real code editor into the admin area of your WordPress site. If you’ve seen cyberpunk-like dark coding screens in the movies, this makes your code look just like that.

To try it out:

  1. Search for Coditor it in the WordPress directory by going to Plugins > Add New.
  2. After installing and activating the plugin, you’ll see a new Coditor option at the left admin menu. Click on it.
  3. At the left panel, choose Theme to edit your theme or Plugin to edit your plugins.
  4. It works just like Windows Explorer or macOS Finder, with the files and folders at the left and the actual file at the right. Simply navigate to the file you want to edit and click it.
  5. At the upper right are buttons for saving your file, undoing and redoing, and searching the text.
  6. You’ll also notice that it highlights the syntax of the code, very useful to figure out what part of the code you’re editing.

———

While there are other ways of editing your plugin, including the roundabout way of downloading, editing and uploading the files, I’ll leave with these two simple tools so that you can start writing code right away. I’m sure you’ll be able to make simple changes from here on.

If you need something more complex or want to customize a plugin to suit your website, let me know. I’d be more than glad to help.

Need a Simple Custom Plugin for WordPress? I Can Build It for You

I’ve been writing about how to make WordPress plugins a lot lately. While I encourage everyone to try creating a simple custom plugin on their own, I also realize that not everyone is inclined to do so.

You might not have the time to spend learning and building a plugin. Or you might have tried building one but discovered that coding really isn’t for you.

If you don’t have the time to build a plugin but still want to add a simple feature or function to your WordPress site, let’s talk and I might be able to build the plugin for you.

If it’s a really useful plugin that we definitely need to share to the world, I can build it for free and then upload it here for everyone to download. We’ll work together to iron out the kinks and you have first dibs in installing it.

For plugins that need a bit of extra elbow grease to make or if you don’t want it to be publicly available, you can also hire me to build it for you. I can both create something from the ground up or modify an existing plugin for your company’s private use.

Interested in getting your plugin idea made?
Post a comment below with your idea, email me or send me a message.