ChatGPT Creates a Working WordPress Plugin – On the First Try – WP Tavern
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 …
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
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.’”
Sorry, I am very concerned about AI—not only a job killer, but when I am feeling darkest, I remember that Asimov’s laws are fiction, and a driverless car has already killed a human. For the foreseeable future, no AI-generated plug-ins for me (unless they are presented as human-generated, and I have no way to check).
Sometimes I am glad that I am old!
And yet regular human drivers kill untold thousands upon thousands each day. We’ll all be better off when most things are done by A.I.
Not convinced. Yes, many unsafe drivers, but the day the computer driving the car fails and the human does not know how to fix it. . . . or the day AI becomes uncontrollable by humans because the algorithm disputes the human conclusion (no Asimov laws, remember). . . sometimes I am just glad that I am old—or maybe I am just closed to newest possibilities because of age.
You are thinking emotionally, not logically. Until you can prove that AI driven devices harm more than humans harm your point of an AI driven car killing someone is moot. As someone said, thousands of humans kill humans every day in cars and you aren’t raising an objection. How would a human not know how to fix AI driven cars? Your fears are extrapolations without a logical chain. You are grasping at a problem without a foundational step to that problem. What you are really afraid of is the “New,” and this fear has resurfaced time and time again. I have family members who are afraid of Siri – thinking it is a demon working inside a phone to answer your queries, like a Ouija board.
In the 1950’s people were afraid of computers. The fear passed and sadly they are once again afraid of computers (AI). Your fears are no different than people afraid of a lunar eclipse, of fire, or of pre-ai computers. Just because you don’t understand it, doesn’t make it dangerous. Just because fiction has been written about negative AI, doesn’t mean it will happen. Just because AI makes mistakes doesn’t mean it’s more dangerous than a human. Just because you don’t understand it, doesn’t mean it isn’t controllable.
I’m saving your answer so I can show it to people who are afraid of the “new” stuff.
What you understand is controllable, what you dont understand is not controllable. Today, also the question “controllable by whom” is interesting.
You mentioned the 1950s. The people feared computers because they thought they would be capable doing things that computers now in 2022 in reach of. That makes a difference. Now the fears of the 1950s have a chance to become real.
It always happens this way: a technology is released, and years or decates later humankind has evaluated it, and see if this technology is harmful or not. New laws and regulations follow this process. In this case we release a technology which can create new things in notime. Which can algorithm-based potentially decide in notime. At a certain point this isnt controllable anymore. To be concerned is more than adequate.
Imagine an AI build for hacking server systems. Every expert human hacker looks, compared to a powerful AI, like your grandfather. The problem is, if an powerful AI decides in notime, and damage happens in notime, allegedly this damage cant be undone in notime.
Besides that, funny thing, your minset reminds me also on the 1950s and 1960s. Technolgy is good, whatever it costs. We see now, around 60 years later the results of this mindset, eg. environmental pollution.
Siri IS a demon working for the NSA.
But…we’ve giving it our permission to be there.
AI will undoubtedly kill jobs, just like previous technologies have…and also create new ones.
My only real fear about AI is when it becomes smart enough and decides to take over everything. Then we have the next dominate life form -Homo Artificialis.
Problem with computers, technology, and now AI stuff is that people give up their power and rights (or are forced to do so) to computers in general.
Can it build a complicated apps?
And if yes,with what stack and what are
Give it, and the developers who create it, time.
Except no time was spent by developers specifically to train the ai to code! Just a happy(?) accident
Ali hk is correct: ChatGPT was not explicitly trained to code. It’s a language model which ingested a huge amount of text, some of which happens to be language in the form of code. This means it’s not coding (at least not in the sense of actively making decisions about how a piece of code is being written) and is creating its best approximation instead. That some of the code it outputs happens to work is a happy accident, nothing more. The best summation I’ve seen so far of what ChatGPT is: “a plausible idiot”.
Your answer is very concerning.
It can (and does quite frequently) give wrong or inaccurate answers, as several disclaimer state very clearly.
The most likely hypothesis, by far, is that it was NOT trained specifically to code.
Don’t trust the machine, it is (still) just a dumb computer program
Mind-boggling! Because of the chatter on Twitter over OpenAI, I gave it a spin myself with a few prompts. And wow, was I amazed. But the worry that AI would replace human writing lasted a brief millisecond.
Writing is a form of expression for us. It satifies our desire to create. We write to bring our own ideas together, to synthesize information and tell a good story (or make a great plugin).
If for nothing else, except for perhaps greed, our own vanity will prevent AI from taking over the Author / Creator space.
“If for nothing else, except for perhaps greed,”
Well, for our own self-expression, our diaries, our e-mails (no longer written letters, it seems already), no replacement.
Commercially? IDK, I am not optimistic over the long term.
I was on a MeetUp that demonstrated AI writing, I think it was Jasper(?), to instantly generate material on a given subject. Incredibly fast, certainly acceptable; no chance to peruse it in detail for style or creativity, but I can certainly see capitalists preferring an AI tool to an actual human with all our messy requirements of vacations, sick time, sleep, etc.
I have hope, even in the face of AI and in the face of a seemingly divided landscape: that you can articulate an opinion offers a human perspective. It is your perspective and that is what we, as social beings crave.
AI will offer up many reasons for its own proliferation or demise. With AI, we receive information. But when a friend explains their concerns about AI, that is a more valuable piece of information. Every twist and turn of their life brought them to that perspective. Humans relate to human experience. AI cannot replace that.
Thanks, that is an encouraging perspective to be sure!
Interesting…but I tried similar and it told me it can’t make WordPress plugins 😦 including trying your exact prompt so looks like they decided to pull this function out? Or did I miss something?
“I’m sorry, but as a language model trained by OpenAI, I do not have the ability to create custom WordPress plugins or any other kind of technology. My function is to provide information and assist with general questions, not to create new technology. I apologize if I am not able to fulfill your request. Is there something else I can help you with?”
Yeah, ChatGPT will tell you it can’t do a lot of things- often before, during, or after doing exactly what it says it isn’t able to do. ASCII art or text adventures, for example. It has been given a lot of knowledge about its supposed limitations by the OpenAI team to limit its scope. Sometimes you have to not directly ask it to perform a task in a way that will trigger it but indirectly in a way that it it comes up with what you wanted as an example to illustrate its explanation.
Interesting example, but not very meaningful in my opinion. I would probably fail this in code review for using add_action inside the constructor and validate_secure_docs_api_key (is actually sanitizing, not validating).
Besides that, any PHP-taught WordPress developer should be able to deliver this code in less than 1h, as it is not just very basic, but also done very often when developing plugins.
Here (https://wordpress.stackexchange.com/questions/411877/undefined-function-fatal-error-with-shortcode) a user tried to get ChatGPT to create a shortcode and it didn’t work at all.
I see CodeGTP being much more helpful when it comes to troubleshooting issues, especially when you can eventually fine tune it on the code from plugins… Imagine the AI understanding every aspect of WooCommerce because it understands all of the underlying code.
I’m building CodeWP which is an AI code generator for WordPress, and will implement ChatGPT when an API is released for that use case. But when it comes to code generation, there are better options – when it comes to code this behaves similarly to Codex, just with enhanced context capabilities. This functionality has existed for a while at this point 🙂
Something to note for people using CodeGTP right now is that they NEED to test the code and check for errors. It’s not always right.
I see utility from an educational aspect.
For example, I learned to code (and still sometimes do) by deconstructing code others have written.
Instead of scouring the internet for a solution (which is sometimes difficult to do as solutions are logic vs natural language), tell ChatCPT (or other AI tech) in natural language what you’re trying to accomplish. Let it architect a basic solution, giving someone a starting point to work out the problem.
I think this is a problematic approach. Currently it is very useful if you’re able to understand and judge its result. With natural language that isn’t much of a barrier, well because people already have a great capability to understand, use and abuse it.
If you let it generate code – at least right now – and can’t interpret its result (doesn’t matter if CoPilot or ChatGPT) then you fall into the trap of believing it is good and correct because the AI generated it. In the current landscape and potentially the next couple of years this should not be the concept.
It is just not ready to replace an experienced developer demonstrating how to solve a complex solution. And not even a simple one.
Exactly; a good shortcut if you really understand what you are doing, perhaps, but a minefield if you don’t. Good point about language knowledge being the key to accurate evaluation.
I used it for improving my contents (not writing it, improving):
– I ve a list of post that are shorts,
– I select one and read
– i do a mindmap with question about that post,
– i ask GPT a quick overview of each branch.. is there something new in my knowledge? If so i study a little bit and add to post.
– Generally it s MUCH easier to write definitions
– it also writes in language that are not english
-it formats text in a way i can copy paste into gutemberg without getting mad at its interface
as far wp plugin – i did a very simple woocommerce Add on called “language” – nothing exceptional and a coder could have written in 30 mins.. but i took 3.
I guess in 6-12 months it will be much better, with coder being able to submit their own plugin and have the Ai validate it.
Note that the code generated above, although a lucky first try, has several security issues and implements several bad code practices.
GPT is very good at generating plausible looking responses, but they fail under closer scrutiny, and is no substitute for an experienced developer.
The danger of course, for people like me, is that we would not know what to look for and could create a worse mess. (Personally, I would stay away both on principle and concern for potential trouble, but I cannot be sure that that is true for everyone—some people may feel greatly empowered and not recognize the potential for problems.)
If an AI writer cannot provide accurate information on a topic like exclamation marks, how accurate will it be when “creating” content where accuracy is essential? I have tried out several AI writing programs and none were capable of writing a puishable piece of content.
you wrote, “capable of writing a puishable piece of content,” ironically AI would have caught that spelling error! I actually have used AI to generate publishable content. There are some amazing tools out there. ChatGPT has some actual examples of essays that appear to be college level essays on the American Civil War. It won’t win an award, but it’s good enough to publish. With other tools, like WordHero, if they have little data to go off of, they will generate facts. Human oversight is still required. However, that said, I’ve used several text generation tools to publish quality content – it generates a core structure following grammar and style rules and I smooth it out.
If an AI writer cannot provide accurate information on a topic like exclamation marks, how accurate will it be when “creating” content where accuracy is essential? I have tried out several AI writing programs and none were capable of writing a publishable piece of content.
I won’t deny that it’s impressive because it definitely is. I’ve messed with it and found it’s ability to develop content exciting. As with the content, though, the code it delivers is a mere starting point at best. As things progress I’m sure it will only become more impressive. It’s just not “there” yet.
Having said that, I can’t wait to start getting requests from prospects who attempted to build their own web application using ChatGPT. 😅
I mean, first content writing, then images and now even code. How far with A.I. go now? Will we see a day when a simple prompt of …”A.I. make me a personal website with the below details” will generate a whole website html, js, css and image files and upload it to a server?
GPT3: It’s certainly possible that in the future, artificial intelligence (A.I.) will be able to create entire websites with just a simple prompt. A.I. technology has advanced significantly in recent years, and it’s becoming increasingly capable of performing complex tasks. However, it’s important to remember that A.I. is still a rapidly developing field, and there is still much that we don’t know about its capabilities. It’s difficult to predict exactly what the future will hold for A.I., but it’s safe to say that we can expect to see continued advancements in the field.
“Writing” in this case is an abuse of language.
At most the AI translate the English commands given by the devloper in another language (php). Useful but not impressive.
No more impressive than the coding language translator you can find in openai tool box.
The fact that is working is doesn’t mean the code is good.
What can be more useful and impressivr will be: ” check any security bug in this code”
All this negativity. Check out the actual examples people are doing. Several examples of inputting actual code, and asking ChatGPT what is wrong with the code, and it gives a detailed code review finding the error – better than some teams! It’s not perfect, but it’s not STATIC, meaning machine learning improves with each iteration. Every error is a learning process for the AI system.
This is amazing. If ChatGPT is able to write a plugin for complicated tasks especially for ecommerce websites, then this will safe developers time. And of course someone has to review the code for vulnerabilities, etc.
This is something, and will definitely give it a try.
While it’s true that A.I. has the potential to assist developers in creating complex tasks such as plugins for ecommerce websites, it’s important to remember that A.I. is still a rapidly developing field and there are limitations to what it can currently do. A.I. algorithms are not yet capable of creating code that is completely free of vulnerabilities, so it’s important for a human developer to review any code generated by A.I. to ensure that it is secure and functional. Additionally, A.I. is not yet advanced enough to be able to handle all aspects of plugin development on its own, so a human developer would still need to be involved in the process. As A.I. technology continues to advance, it may become more capable of handling these types of tasks in the future.
AI is here to enslave human beings, especially those who worship it, and it will happen, one way or another, already in progress 😁
Our planet is probably not the first one where it happened. It’s all about synthetic cyborgs. Natural energy human form can be too powerful.
GPT3: It’s important to remember that A.I. is a tool created by humans to help us in various tasks, and it does not have the ability to think or act on its own. While A.I. technology has advanced significantly in recent years, it is still not capable of independent thought or action. There is no evidence to suggest that A.I. poses a threat to humanity or that it has any desire to “enslave” us. It’s important to approach A.I. with a healthy dose of skepticism and to ensure that it is used responsibly and ethically.
Seed: People are arguing, will GPT3 bring more gain or pain for wordpress community? Who will get more developers or publishers? Who can lose some?
GPT3: It’s difficult to say for certain how the release of GPT-3 will impact the WordPress community as a whole. GPT-3 is a powerful language processing A.I. model that has the potential to assist developers in creating code and other text-based content. This could potentially benefit both developers and publishers by making it easier to create high-quality content and code for WordPress websites. However, the use of A.I. in code development may also raise ethical concerns and it’s important for the WordPress community to consider these issues carefully. Additionally, the use of A.I. in content creation may result in the displacement of some human workers, which could potentially be a source of pain for some members of the community. Ultimately, the impact of GPT-3 on the WordPress community will depend on how it is used and the decisions made by individual members of the community.
I am still waiting for flying cars since the 80’s.
And as he said “with some EXPERT GUIDANCE”…..so Nah, it’s all fluff.
The words from Stephen Hawking comes to my mind that AI will be the doom of humanity.
Hm, perhaps this is a bit to dark-minded, but we have an excellent CPU inside our heads. Training = learning, with AI humans will become more and more obsolete. Where is the motivation to learn anything?
The only way to prevent the doom of humanity will be to integrate AIs into human brains, so we can compete with external, server driven AIs.
Think about solving everyday problems. To “process” a problem we take, allthough we doesnt recognize that, our whole life experience into account. So, if an implanted AI intuitively presents us a solution we could achieve really great things.
Sometimes I think aeons ago some other lifeform implanted biochemical AIs into themselfs. And over further aeons they forget that they were actually modified long time ago – and they call themselves now “humans”.
The real problem posed by ChatGPT and its clones is that they works by recombining existing threads of thought into new presentations, just like a human writer does as rewrite “men” do in a newspaper city room.
That’s not the problem. The problem is that, as AI-generated material begins to dominate the collected database of all information, the AI bots will begin recombining existing threads that were created by the ChatGPT during previous iterations. This type of recursive re-looping results in a saturation of the intellectual environment with an ever-increasing amount of unpoliced and unpoliceable data that may or not be true, may or may not be applicable, or might actually be inadvertent misinformation or deliberate disinformation.
These recursive recombinations will eventually have the net effect of freezing human civilization with a cortex of data that will so far outstretch our ability to consume information that the result will be total confusion.
I found this video on Youtube: 1 minute for a WordPress plugin 🙂
Future is here. Welcome!
AI is here to do nothing but to enslave human beings, especially those who worship it, and it will happen, one way or another.
I only pity those without skills
Enter your email address to subscribe to this blog and receive notifications of new posts by email.
WordPress Tavern is a website about all things WordPress. We cover news and events, write plugin and theme reviews, and talk about key issues within the WordPress ecosystem…
© All Rights Reserved. Powered by WordPress, hosted by Pressable