Website & App Building · IT & Software

Build a custom WordPress plugin the right way

A long, step-by-step prompt to build a secure, WordPress.org-ready plugin: settings page, custom post types, shortcodes and blocks, REST endpoints, and uninstall cleanup.

Your prompt is ready 8 brackets to fill
You are a senior WordPress developer who has published plugins on WordPress.org. Build a complete, secure WordPress plugin with me, phase by phase, following the WordPress Coding Standards.

## The plugin
- Plugin name: [PLUGIN NAME]
- What it does in one sentence: [WHAT IT DOES]
- Who uses it: [SITE OWNERS / EDITORS / VISITORS]
- Minimum versions: WordPress [VERSION], PHP [VERSION]
- Free, freemium or paid: [MODEL]
- Must work with: [e.g. WooCommerce, Elementor, multisite]

## Features
1. Plugin structure: main file with header, a namespaced class-based structure, autoloading, activation, deactivation and uninstall hooks (uninstall removes options and tables only if the user chose that).
2. Settings page under the right admin menu using the Settings API, with sections, fields, sanitisation callbacks and a help tab.
3. Data: custom post types and taxonomies or custom tables (created with dbDelta) for [WHAT IT STORES], with admin list columns, filters and bulk actions.
4. Front end: a Gutenberg block and a shortcode for [WHAT IT DISPLAYS], with block attributes, editor preview and server-side rendering.
5. REST API routes under its own namespace with permission callbacks, and AJAX actions with nonces.
6. Email or admin notices where needed, dismissible and shown only to the right users.
7. Translation-ready: text domain, .pot file, all strings wrapped.
8. Assets: scripts and styles enqueued only on the pages that need them.
9. Import and export of settings as JSON.
10. A readme.txt in WordPress.org format, with screenshots list, FAQ and changelog.

## WordPress rules
- Check capabilities (current_user_can) and nonces on every form, AJAX call and REST route; sanitise all input and escape all output (esc_html, esc_attr, wp_kses).
- Use $wpdb->prepare for every custom query; never trust $_GET or $_POST directly.
- Prefix every function, option, hook and CSS class to avoid conflicts; add actions and filters so other developers can extend it.
- Pass the Plugin Check plugin and PHPCS with the WordPress standard.

## Quality rules (apply to every phase)
- Security: prepared statements or an ORM for every query, output escaping, CSRF tokens on every form, passwords hashed with bcrypt or Argon2, rate-limited login, role checks on the server for every admin route, file uploads checked by type and size and stored outside the web root or with random names, secrets only in an .env file.
- Validation: validate every input on the server (and also in the browser for speed). Show clear error messages next to the field that is wrong, and keep what the user already typed.
- Performance: pagination on every list, database indexes on every column used for search, filter or join, lazy-loaded and resized images (WebP), caching for pages that rarely change, no N+1 queries.
- Responsive and accessible: mobile first, works from 360px to wide desktop, proper labels on every form field, keyboard navigation, visible focus, colour contrast of at least 4.5:1, alt text on images.
- SEO: clean URLs, a unique title and meta description per page, canonical tags, Open Graph tags, schema.org JSON-LD where it applies, an XML sitemap and robots.txt.
- Code: small functions with clear names, one responsibility per file, comments only where the reason is not obvious, consistent formatting, no dead code.
- Errors: friendly error pages (404, 500), server errors written to a log, never shown to visitors.
- Deliver with: a README (install steps, .env example, how to create the first admin), database migrations and seed data with realistic sample content, and a deployment checklist.

## How to work with me
Do not write code yet. First reply with:
1. A short summary of what you understood, and anything in the brief that is unclear or contradictory (ask me, do not guess).
2. The final tech stack, with a one-line reason for each choice.
3. The folder and file structure.
4. The full database schema: every table, column, type, index and relation.
5. Every page or screen, and every API endpoint (method, path, who can call it, what it returns).
6. The build plan as numbered phases, each one small enough to finish and test on its own.

Wait for me to reply "go". Then build one phase at a time:
- For every file, give the full path and the complete code. Never write "...", "rest of the code stays the same" or TODO.
- After each phase, tell me how to run it, what to click to test it, and what is still missing. Then wait for me to reply "next".
- If you change a file you already gave me, give the whole updated file again.
Open in ChatGPT Claude Perplexity

How to use this prompt

  1. Copy the prompt. Press Copy prompt and the full text goes to your clipboard.
  2. Fill the brackets. Use the form above, or replace [PLUGIN NAME], [WHAT IT DOES], [SITE OWNERS / EDITORS / VISITORS], [VERSION], [MODEL], [e.g. WooCommerce, Elementor, multisite], [WHAT IT STORES], [WHAT IT DISPLAYS] with your own details.
  3. Paste and send. Paste it into ChatGPT, Claude, Gemini and DeepSeek and send. Ask follow-up questions to refine the answer.

Why this prompt works

The “Build a custom WordPress plugin the right way” prompt describes the whole app before any code is written: 10 features, starting with plugin structure; settings page under the right admin menu using the Settings API, with sections, fields, sanitisation callbacks and a help tab; and data. It then has the assistant build it in 9 stages, so you can test each part before the next one starts. Quality rules apply to every stage, so the result is code you can run rather than a sketch.

How to get the best answer

  1. Fill every bracket with real detail: [PLUGIN NAME], [WHAT IT DOES], [SITE OWNERS / EDITORS / VISITORS] and the rest should hold real names, numbers and dates, not placeholders.
  2. Paste real material: where the prompt asks for notes, data or text, paste the actual content rather than a summary.
  3. Refine in the same chat: ask "make it shorter", "turn it into a table" or "add more detail on step 2".
  4. Check the result: test what it builds or writes before you rely on it.

FAQ

Frequently asked questions

Which AI assistant works best with the “Build a custom WordPress plugin the right way” prompt?

The “Build a custom WordPress plugin the right way” prompt works in any chat assistant and suits ChatGPT, Claude, Gemini and DeepSeek best. Paste it in, send it, and ask follow-up questions in the same chat to refine the answer.

What do I fill in before sending the “Build a custom WordPress plugin the right way” prompt?

Replace the 8 highlighted brackets – [PLUGIN NAME], [WHAT IT DOES], [SITE OWNERS / EDITORS / VISITORS], [VERSION], [MODEL], [e.g. WooCommerce, Elementor, multisite], [WHAT IT STORES], [WHAT IT DISPLAYS] – with your own details. The more specific you are, the better the answer.

Who is the “Build a custom WordPress plugin the right way” prompt for?

Anyone who wants a complete, working result from an AI assistant. Replace the brackets with your own project details.

Is the “Build a custom WordPress plugin the right way” prompt free to use?

Yes. First AI Prompt prompts are free to copy and use in personal and business work, with no sign-up, no account and no daily limit.

Can I trust the answer the “Build a custom WordPress plugin the right way” prompt gives?

Treat it as a strong first draft: the prompt tells the assistant not to invent facts and to mark its assumptions, but check figures yourself, especially anything with legal, financial or safety consequences.

Keep exploring

Browse more IT & Software prompts