ChatGPT Creates a Working WordPress Plugin – On the First Try

ChatGPT passed 1 million users today and Twitter is brimming with a steady stream of creative questions and applications for the AI-powered chatbot. The language model, created by OpenAI, is powered by GPT-3.5, a series of models trained on text and code from before Q4 2021. The model features a dialogue format that gives ChatGPT the ability to “answer followup questions, admit its mistakes, challenge incorrect premises, and reject inappropriate requests.”

While some are busy predicting the end of search engines and sounding the death knell for human-generated writing, others are fascinated by the potential of AI systems to fundamentally reshape the process of creation. WordPress developer Johnathon Williams brought this close to home when he asked ChatGPT to spin up a WordPress plugin.

Ordinarily, plugin creation is a task that requires a certain level of technical proficiency. Williams demonstrated that, with a little bit of expert guidance, ChatGPT can drastically reduce the amount of time it takes to extend WordPress.

ChatGPT wrote a working WordPress plugin for me today on the first try.

Custom menu item, custom admin screen, saving a custom options value, validating the field before saving …

Holy hell.
— Johnathon Williams (@johnofhousejohn) December 5, 2022

Williams installed the plugin and found that it worked on the first try. Although he didn’t save the prompt for this first try, he published a gist on GitHub of the generated code.

On a second attempt of creating a different plugin, he used the following prompt:

Create a custom WordPress plugin called “Big Daddy Media” that deletes images older than one year from the media library. OOP. Custom admin screen. one button delete. log the full URL of all deleted media files.

He published a screen recording of ChatGPT at work creating the plugin:

Open AI's ChatGPT can generate an entire WordPress plugin based on a simple description.

Watch it work: pic.twitter.com/LZQbxFq0aP
— Johnathon Williams (@johnofhousejohn) December 6, 2022

Williams said that although he’s had mixed results with his prompts, he has gotten the best results from asking ChatGPI to generate entire functions versus specific filters or actions.

Theoretically, with additional training on plugin best practices and common architecture, ChatGPT could be used by people of all skill levels to extend WordPress in creative ways.

“Very soon, describing the WordPress plugin you need to ChatGPT will generate a new one faster than searching for an existing one in the plugin directory,” Williams said. “This won’t be true for all types of plugins, of course. But for relatively simple plugins performing established tricks … well *very soon* should probably read ‘right now.'”