Skip to content

Preparing Your Plugin – AKA The Pre-Launch Glow-Up ​

Alright, plugin prodigy — time to clean up that code like it’s going on a date with the WordPress Plugin Directory. This step is all about turning your “it works on my localhost” code into something even the WordPress reviewers will swipe right on. 💅

Why You Need to Prepare ​

Submitting a messy plugin is like trying to rent an apartment with a resume that says "Professional Noodler, Plot No 79." You might be a genius, but first impressions matter.

Your plugin needs to:

  • Not break websites (this is kind of important 😅)
  • Be secure (hackers love bad plugins)
  • Follow WordPress coding standards (no, you’re not special)
  • Be understandable to someone who isn’t in your brain

The Official Folder Structure 🗂️ ​

Here’s the folder structure you should follow:

my-noob-plugin/
├── my-noob-plugin.php
├── readme.txt
├── assets/
│   └── banner-772x250.png
├── includes/
│   └── fancy-helper-functions.php
└── languages/
    └── my-awesome-plugin.pot

Your main plugin file should match your plugin’s folder name. Why? Because chaos is bad, and reviewers like order.

The Plugin Header ​

At the top of your main file, you need this magical comment block:

php
<?php
/**
 * Plugin Name: My Noob Plugin
 * Description: Makes things awesome to Noob.
 * Version: 1.0
 * Author: Kahnu
 * License: GPL2
 */

This is your plugin’s business card. Don’t mess it up. Also — don’t forget the license. WordPress is open-source; it’s not a free-for-all.

Best Practices (aka, “Please don’t get rejected” checklist) ​

✅ Sanitize all input. Yes, even that dropdown.

✅ Escape output. XSS is not a superhero.

✅ Use nonces. Not just a funny word — it prevents CSRF.

✅ Prefix functions. No one wants to overwrite get_data() from your plugin.

✅ No echo in the middle of nowhere. Respect the hooks.

✅ Translation-ready. Wrap your strings like this:

php
__('Hello world', 'my-noob-plugin');

How to Check All This Without Crying ​

  • Install Plugin Check plugin.
  • Use PHP Code Sniffer with WordPress rules.
  • Ask a friend to test it. Or a cat. At least they’ll give you honest feedback.

Take a break, pat yourself on the back, and maybe rename that final_final2.php to something nicer. 😎

Built by noobs, for noobs, with love 💻❤️