Open the plugin and look around
A sample plugin, Store Finder, file by file.
store-finder.phpMain file
Plugin header, autoloader and the hooks that wire everything together. Nothing runs on load except registration.
Read the detail: store-finder.phpMain file
<?php /** * Plugin Name: Store Finder * Requires at least: 6.5 * Requires PHP: 8.1 * Text Domain: store-finder */ defined( 'ABSPATH' ) || exit; require __DIR__ . '/vendor/autoload.php'; add_action( 'init', [ Store_Finder\Blocks::class, 'register' ] ); add_action( 'rest_api_init', [ Store_Finder\Rest::class, 'routes' ] ); add_action( 'admin_menu', [ Store_Finder\Settings::class, 'page' ] );
block.jsonEditor block
The block is described in JSON, so WordPress loads its scripts and styles only on pages that use it.
Read the detail: block.jsonEditor block
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "store-finder/list",
"title": "Store Finder",
"category": "widgets",
"attributes": { "layout": { "type": "string", "default": "cards" } },
"supports": { "color": { "background": true }, "spacing": { "padding": true } },
"editorScript": "file:./index.js",
"viewScriptModule": "file:./view.js",
"render": "file:./render.php"
}class-rest.phpREST route
A REST endpoint the block calls. Inputs validated, permission checked, response cached.
Read the detail: class-rest.phpREST route
register_rest_route( 'store-finder/v1', '/stores', [
'methods' => WP_REST_Server::READABLE,
'permission_callback' => '__return_true',
'args' => [
'near' => [ 'sanitize_callback' => 'sanitize_text_field' ],
'per_page' => [ 'validate_callback' => fn( $v ) => absint( $v ) <= 50 ],
],
'callback' => [ self::class, 'list_stores' ],
] );class-settings.phpSettings screen
Uses the Settings API so options are registered, sanitised and stored the standard way.
Read the detail: class-settings.phpSettings screen
register_setting( 'store_finder', 'store_finder_options', [ 'type' => 'array', 'sanitize_callback' => [ self::class, 'sanitize' ], 'default' => [ 'open_badge' => true, 'layout' => 'cards' ], ] ); add_options_page( __( 'Store Finder', 'store-finder' ), __( 'Store Finder', 'store-finder' ), 'manage_options', 'store-finder', [ self::class, 'render' ] );
class-cli.phpWP-CLI command
Ops jobs run from the terminal or cron, not from a slow admin page.
Read the detail: class-cli.phpWP-CLI command
/**
* Import stores from the ERP feed.
*
* ## OPTIONS
* [--dry-run]
*/
WP_CLI::add_command( 'store-finder import', function ( $args, $assoc ) {
$rows = Feed::fetch();
$done = Importer::run( $rows, ! empty( $assoc['dry-run'] ) );
WP_CLI::success( sprintf( '%d stores imported.', $done ) );
} );uninstall.phpClean exit
When the plugin is deleted, its data goes with it. No orphaned options or tables.
Read the detail: uninstall.phpClean exit
<?php
defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
delete_option( 'store_finder_options' );
delete_site_option( 'store_finder_network' );
global $wpdb;
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}store_finder" );The four mistakes we never ship
Each one is shown as risky code first, then the hardened version.
Cross-site request forgery
A form saves settings for anyone who can trick an admin into clicking a link.
Riskyupdate_option( 'sf_key', $_POST['key'] );Hardened
check_admin_referer( 'sf_save' ); if ( ! current_user_can( 'manage_options' ) ) wp_die(); update_option( 'sf_key', sanitize_text_field( wp_unslash( $_POST['key'] ) ) );
Cross-site scripting
A store name containing a script tag runs in every visitor’s browser.
Riskyecho '<h3>' . $store->name . '</h3>';Hardened
echo '<h3>' . esc_html( $store->name ) . '</h3>';
SQL injection
A search box passes raw text straight into a database query.
Risky$wpdb->get_results( "SELECT * FROM {$t} WHERE city = '$city'" );Hardened$wpdb->get_results( $wpdb->prepare(
"SELECT * FROM {$t} WHERE city = %s", $city ) );Open REST endpoint
An endpoint that changes data with no permission check.
Risky'permission_callback' => '__return_true',Hardened
'permission_callback' => fn() => current_user_can( 'edit_posts' ),
One plugin, a whole network of sites
Activate once for the network, then let each site keep its own settings.
Directory-ready before we submit
Plugins on WordPress.org are reviewed by volunteers. We run the same checks first, fix what they would find, and ship a readme that answers their questions.
Plugin Check · store-finder 1.2.0
- Security18/18
- Performance11/12
- Accessibility9/9
- Internationalisation14/14
- Directory guidelines10/10
Warning: one admin script loads on every admin page. Fixed in 1.2.1 by loading it only on the settings screen.
What a WordPress plugin does from install to delete
Most plugin bugs we’re asked to fix sit at the edges of the feature: the first activation, the update nobody tested, the uninstall that left forty options behind. This is the life of a plugin and what we put in at each stage.
Activate
Create custom tables with
dbDelta(), store default options, save a schema version number, and flush rewrite rules once, all of it quick. If activation needs to import data, we queue it instead of making the admin stare at a spinner.register_activation_hookLoad on every request
The main file only registers hooks, blocks and routes. Classes autoload when they’re first used. Translations load on
initor later, because WordPress 6.7 now warns when a text domain loads too early.plugins_loaded · initServe
REST routes, settings screens, blocks and WP-CLI commands each get their own class. Admin scripts load only on the plugin’s own screen, and front-end assets only on pages that use the block.
rest_api_init · admin_menuUpdate
WordPress doesn’t run activation hooks on update. So we compare the saved schema version with the code’s version on load and run any migrations once, in small batches, with a WP-CLI fallback for big sites.
stored version vs new versionDeactivate
Clear scheduled cron events, flush rewrites, keep the data. People deactivate to troubleshoot. Wiping their settings at this point is a nasty surprise.
register_deactivation_hookDelete
Only when the plugin is deleted do we remove options, custom tables, transients and user meta. On multisite we loop through each site, because a network uninstall doesn’t do that for you.
uninstall.php
In practice, a plugin that handles its own updates means you can click “Update” on a Monday morning without booking a developer for the afternoon.
The WordPress.org plugin guidelines, explained
Every new plugin submitted to the directory is read by a person on the Plugin Review Team before it goes live. The guidelines are public and fairly short. These are the ones that catch most first submissions, and what we do about each before we press submit.
GPL-compatible, all of itLicensing
The plugin’s code, its bundled libraries and its images must all carry a GPL-compatible licence. You can still sell a premium add-on or a service, but the directory version can’t be a trial that locks features after 14 days or behind a licence key.
What we do Check every Composer and npm dependency’s licence before we bundle it, and keep paid features in a separate add-on plugin.
Code a human can readNo obfuscation
Obfuscated or packed PHP is rejected. Minified JavaScript is fine as long as the readable source ships in the plugin or is publicly linked, which matters for any block built with a bundler.
What we do Ship the
src/folder alongsidebuild/, and say so in the readme.No phoning home without opt-inPrivacy and external services
Usage tracking needs the site owner’s explicit consent. If the plugin talks to an outside service (a shipping API, a licence server, your SaaS), the readme has to name the service, say what data is sent and when, and link to its terms and privacy policy.
What we do Tracking off by default, an “External services” section in readme.txt, and no remote calls until the admin has connected an account.
Sanitise in, escape outSecurity
This is where most rejections land. Reviewers check that input is sanitised and validated, output is escaped late, forms use nonces, actions check capabilities and SQL uses
$wpdb->prepare(). One unescapedechois enough for a “please fix and resubmit”.What we do Run PHPCS with the WordPress Coding Standards ruleset in CI, so a missed escape fails the build long before a reviewer sees it.
Use what WordPress already shipsBundled libraries
Plugins shouldn’t bundle their own copy of jQuery, React or other libraries core already includes, and they shouldn’t load scripts or fonts from a third-party CDN unless that’s the service the plugin exists to provide.
What we do Declare dependencies through
@wordpress/scripts, which writes the asset file listing core handles for you.A readme.txt that answers questionsListing
The readme sets the “Tested up to”, “Requires PHP” and “Stable tag” values, the short description (150 characters at most), the FAQ, screenshots and changelog. The plugin’s name can’t start with someone else’s trademark, which is why so many plugins end in “for WooCommerce”.
What we do Validate the readme with the official validator and keep “Tested up to” current after every core release.
Releases go through SVNDeployment
Once approved, you get an SVN repository with
trunk/,tags/andassets/. The “Stable tag” in trunk’s readme decides which tagged version people actually download. Get it wrong and users either get nothing or get untested code.What we do Develop in Git and deploy tags to SVN from a GitHub Action, so nobody hand-copies files at 11pm.
Run Plugin Check firstPre-flight
Plugin Check (PCP) is the official tool the review team maintains. It runs many of the same automated checks reviewers rely on: escaping, direct file access, prefixing, readme headers, i18n and more. It won’t catch everything, but a clean run removes the obvious round trips.
What we do Run Plugin Check from WP-CLI on every pull request and treat its errors as build failures.
Six plugin mistakes that slow WordPress down
We inherit a lot of plugins written by someone else. None of these break the site on day one. They just make every page a little heavier, and every update a little scarier, until someone asks why the admin takes eight seconds to load.
Storing a huge array as an autoloaded option
Everything marked autoload is read from the database on every single request, front end and admin. It isn’t rare to find a plugin keeping a multi-megabyte log in one. Site Health now flags large autoloaded options for exactly this reason.
Costs you Slower time to first byte on every page, not just the plugin’s.
CSS and JS on every page
A contact-form script loaded on the product archive. Multiply by fifteen plugins.
Costs you Core Web Vitals, and buyers on mobile data.
Filtering on meta values at scale
A meta_query on an unindexed value is fine with 500 posts and painful with 500,000.
Costs you Database load, and timeouts on search pages.
Heavy jobs on init
Syncing a feed while a visitor waits. That belongs in WP-Cron or Action Scheduler, in batches.
Costs you Random slow page loads you can’t reproduce.
No prefix, no namespace
A global function called get_settings() will collide with something eventually.
Costs you A fatal error the day another plugin updates.
Raw cURL and no timeouts
Calling an API with file_get_contents() or bare cURL skips the HTTP API’s proxy settings, SSL handling and filters. We use wp_remote_get() with a short timeout and cache the answer in a transient.
Costs you The whole site hanging when someone else’s API is down.
WordPress plugin terms you’ll hear on the call
You don’t need any of this to hire us, but these words come up in quotes, tickets and changelogs, so here’s what each one means.
- Hook
- A named moment where WordPress lets a plugin step in. Actions run code at that moment; filters change a value on its way through.
- Nonce
- A short-lived token on a form or link that proves the request came from your own admin screen, not a forged page elsewhere.
- Capability
- A permission such as
manage_optionsoredit_posts. We check capabilities, not role names, so custom roles keep working. - Transient
- A cached value with an expiry time. Handy for API responses. With an object cache like Redis it lives in memory instead of the options table.
- block.json
- The file that describes a custom block: its name, settings and assets. WordPress reads it and loads only what each page needs.
- Text domain
- The label that ties a plugin’s strings to its translations. It must match the plugin’s slug for WordPress.org language packs to work.
- Stable tag
- The line in readme.txt that tells WordPress.org which tagged release to offer as the download and update.
- Plugin Check
- The official plugin, maintained by the review team, that scans code for security, performance and guideline problems before you submit.
About WordPress plugins
Anything else, ask on the audit call.
Ask an engineer
Not answered here? Ask on the free 30-minute audit call. An engineer replies within one business day.
Quick facts
- Based in Delhi, India Working across time zones, with written weekly updates.
- Fixed quote first Nothing is billed before you agree it.
- You own it The code, workflows and accounts are yours.
- Stores and ERPs Shopify, BigCommerce, WooCommerce and Adobe Commerce, with NetSuite, SAP Business One, Odoo and Dynamics 365.
Do we need a custom plugin or an existing one?
If a well-maintained plugin does the job, use it. A custom plugin makes sense when the job is specific to your business, when you are stacking several plugins to fake one feature, or when an existing plugin is slowing the site down.
Will the plugin work with the block editor?
Yes. We build custom blocks registered with block.json, so editors place and configure them visually, and we support full site editing themes.
How do you keep a plugin secure?
Every request checks capabilities and nonces, every input is sanitised, every output is escaped and every database query is prepared. We run WordPress’s Plugin Check tool and a static analyser on each release.
Can you publish the plugin on WordPress.org?
Yes. We prepare the readme, licensing and code to the directory guidelines, submit it, answer the review team and set up the SVN release process.
Does it work on multisite?
We build and test for multisite when you need it: network activation, per-site settings and network-wide admin screens.
How long does WordPress.org plugin review take?
It depends on the review queue, which the team publishes. We plan for a few weeks from submission to approval, and reply to reviewer emails the same day so we don’t lose our place. Updates to an approved plugin don’t go through manual review.
Can we sell a premium version of a free plugin?
Yes. The free plugin on WordPress.org must work on its own and can’t lock features behind a licence key. Paid features go in a separate add-on plugin sold from your own site, which is the pattern most freemium plugins use.
Which WordPress and PHP versions will the plugin support?
We set Requires at least and Requires PHP in the plugin header, usually the last few WordPress releases and a PHP version that still gets security fixes. We test against the current release and the minimum we declare, then against each new beta before it ships.
Will a WordPress core update break the plugin?
Not if it sticks to public APIs and hooks. We run our test suite against WordPress betas and release candidates, so problems show up weeks before the update reaches your site.
Who owns the plugin code?
You do. WordPress plugins are licensed under the GPL, and we hand over the Git repository, build scripts and documentation at the end of the project.
Do you write automated tests for plugins?
Yes. PHPUnit integration tests run against a real WordPress in wp-env, and Playwright covers the editor and front end for blocks. Both run on every pull request.
What should your
plugin do?
Tell us the job, your theme and hosting, and whether it should go on WordPress.org. An engineer replies within one business day.
What happens next
- An engineer replies Within one business day, by email.
- A free 30-minute audit On a call with an engineer.
- A fixed quote It follows the audit. Nothing is billed before you agree it.