Start a project
contact@dicecodes.com

WordPress AI Prompt Builder

Get WordPress code that escapes its output, uses hooks and does not touch core. Pick what you are building, describe the behaviour, and this writes the prompt with the conventions an AI otherwise ignores.

Describe the behaviour, not the code you imagine.

Rules to enforceLeave them all on unless you know why you are turning one off.

Why WordPress code from an AI needs watching

Ask any model for “WordPress code” and it will write something that runs. It will also, more often than not, echo a variable straight into the page without escaping it, reach for jQuery because most of its training data did, suggest editing a plugin file directly, and write a hook callback with no default on its second parameter.

None of that is incompetence. It is an average of fifteen years of tutorials, and a lot of those tutorials were wrong. Naming the rules in the prompt is what moves the output from average to current.

The rules this prompt enforces

Ask for the hooks before the code

The prompt ends by asking which hooks it chose and why, and what it assumed about your site. That is the part worth reading. Code that works on a single site and breaks under an object cache or on multisite usually fails at an assumption, not at a line.

Where this fits

It is a drafting tool, not a review. Read what comes back, and if it touches payments, user data or anything you cannot roll back, have somebody who knows WordPress read it too. We do that as part of WordPress development, and most of the hacked sites we clean got there through code somebody pasted in without reading.

For the plugin side of the same question, is there one plugin that does everything is the honest answer.

Which AI is best for WordPress code?

Claude and ChatGPT both do well with a specific prompt. The difference between models matters far less than the difference between a vague prompt and a constrained one.

Is it safe to run code an AI wrote?

Not without reading it. Check the escaping, check it is not writing to the database directly, and test it somewhere that is not your live site.

Why does the prompt insist on default parameters?

Because a WordPress hook can call your callback with fewer arguments than you declared, and in PHP 8 that is a fatal error rather than a notice. A default turns a white screen into nothing happening.

Does this work for WooCommerce?

Yes, it is one of the task options. WooCommerce has its own hooks and its own ways of being broken, so describe the behaviour precisely.

Code came back and you are not sure about it?

Send it over. We will tell you what it does, what it misses and whether it is safe to run.