Turns out, ChatGPT is quite good at writing WordPress plugins

Martin Brinkmann
Feb 7, 2023
Misc
|
4

ChatGPT has been used for a wide variety of projects already. From writing novels and song texts to code snippets and building websites. The AI is also used by cybercriminals, for instance to write better phishing emails or malware. There seems to be nothing that the language model can't do, at least if it does not require data that is from 2022 or later.

Turns out, ChatGPT has another ace up its sleeve: the creation of WordPress plugins. WordPress is the most popular content management system on the Internet. Part of WordPress' popularity comes from its extensibility. Users may create custom themes and plugins, or install hundreds of thousands of themes and plugins that are already available.

Both tasks, creating themes and plugins, requires certain skills. Creating themes requires knowledge of WordPress' themes system, CSS, HTML and related topics. Plugins require knowledge of the plugin system and a good understanding of JavaScript, PHP and HTML.

WordPress site owners who do not know anything about programming had to resort to hiring programmers to create plugins for specific tasks. Now, it appears there is another possibility, at least when it comes to the creation of simpler plugins: asking ChatGPT to write them for you.

Create WordPress plugins with ChatGPT

It took ChatGPT five minutes to write a complete WordPress plugin according to David Gewirtz, who wrote about the experiment on ZDnet. ChatGPT created the user interface, the logic and all the necessary elements to install the plugin in WordPress.

Gewirtz instructed ChatGPT to write the plugin using a single sentence. The AI wrote the code within a minute and when Gewirtz tested it in WordPress, he noticed that it was working exactly as instructed.

Adding more capabilities to the plugin was not difficult either. When Gewirtz noted that the plugin would sometimes output duplicates, he added instructions to avoid that.

The quality of the output depends largely on the instructions. If these are lacking, the code may turn out in a different way than expected. It is easy enough to react to these challenges though, by improving the instructions.

When Gewirtz analyzed the quality of the code, he noticed that the code was working, but that it did not "incorporate all the best practices of WordPress programming". Some of these, like code sanitizing, could be resolved to a degree by adding these to the instructions.

Conclusion

Gewirtz ran into several Cul-de-sacs during his interactions with ChatGPT. He concluded that ChatGPT in its current from worked reasonable well as a WordPress plugin developer. Caveats are that plugins need to be reasonably simple, that the output is not always adhering to best practices, and that code maintenance is not the AI's strongest talents.

With these caveats in mind, Gewirtz believes that ChatGPT and other AIs of its kind will, "almost undoubtedly", reduce the number of human programming gigs in the future. Experienced developers and writers, on the other hand, are less likely to be impacted by the rise of AI, at least for the foreseeable future.

Summary
Turns out, ChatGPT is quite good at writing WordPress plugins
Article Name
Turns out, ChatGPT is quite good at writing WordPress plugins
Description
ChatGPT may be used to write WordPress plugins that work, but there are caveats when it comes to the code of the artificial intelligence.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Marina Black said on February 8, 2023 at 2:40 pm
    Reply

    A useful post for TemplateMonster customers.

  2. David said on February 8, 2023 at 1:57 am
    Reply

    As a programmer from the Pleistocene, when APIs were actually documented, I lament the age of Open Source mainly because the documentation is so awful. The snide response to this complaint is always “then read the source code.” We are entering an age where it will increasingly be left to AI to figure out how APIs are *supposed* to work. As a consequence the documentation (such as it is) will get even worse and more sparse. Is this progress? Nope.

  3. John G. said on February 7, 2023 at 8:39 pm
    Reply

    ChatGPT can be used to fight against viruses, malware and trojans.

  4. Seeprime said on February 7, 2023 at 6:18 pm
    Reply

    If it can prevent coding vulnerabilities, this might just be a very good thing.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.