Magazine

How to Create ChatGPT WordPress Plugin

Posted on the 09 February 2023 by Umargeeks

We shall learn today, about How to Create ChatGPT WordPress Plugin. Further, we shall discuss and explain the current topic in possible detail. This is simultaneously intriguing, amazing, and terrifying.

The team of experts is more than a little frightened, not to put too fine a point on it. They experimented by asking ChatGPT to create a plugin to let them manage their website more quickly. Team provided a brief description and ChatGPT created the entire application, including the user interface and logic in less than five minutes.

There are consequences. We’ll discuss it in a moment. Let me first describe the incident and what happened. Then let us learn, about How to Create ChatGPT WordPress Plugin.

My friend owns an online store using WordPress that caters to a well-liked pastime. He also runs a trendy Facebook community for visitors to his website. The friend generates a list of names at random each month and uses it to create an animation of a spinning wheel for the Facebook group. He has been utilizing a website that performs a decent job of randomly generating lines but overcharges for exporting the list.

Read more: The ChatGPT Rival to Google Pauses

I thought it can use if I quickly built a WordPress plugin we can install on his site as I observed his struggle to get the randomly generated names back out. He frequently uses the dashboard, thus adding that capability will helpful.

But with the user interface components and logic code, even a straightforward plugin will take us a few days to build, and we already have a lot of projects on the go.

The Demand How to Create ChatGPT WordPress Plugin

A well-written prompt is essential to getting ChatGPT to create anything. Consider programming to a manager or client. To acquire what you desire. You must express your needs in detail. We began to use a very simple query to test its viability. We used the following prompt:

It produced the code you can see to the right in less than a minute. I created an a.php file with the produced code pasted into it, placed it in a folder with the same root name, compressed it, and submitted it to his server. It succeeded.

My friend appropriately impressed and shocked when I showed him. But then the wheels started turning, and he requested a new feature: make sure that identical names do not show next to one another.

He occasionally needs to list someone’s name many times for her application. He didn’t want the duplicates to group together though.

We changed our original challenge and added the following extra conditions:

(Unless there is no other option)…ensures that no two similar entries are placed next to one another. with the number of input lines and the number of lines in the outcome being the same.

Because we wanted to make sure all the names include and were worried that it may favor the condition that no two names be side-by-side above maintaining all the names. We added the “unless there’s no other alternative” clause and the requirement that identical counts use.

We got a new plugin a little over a minute later. That one was posted to the server, and we used it. Although several lines in the output were blank, it still functioned. So we added the following restriction to my earlier request:

without any blank spaces

We had become used to the turnaround time by this point, which was always under a minute. It worked after one more upload and test.

To verify how many lines had been processed. We required one last feature. We requested that the plugin provide a line count for the entry and output fields. This is a quick addition:

Under the first field, indicate “Line to randomize:” And the number of nonempty lines in the source field. Under the second field. show the number of non-empty lines in the destination field along with the text “Lines that have been randomized: 

This largely worked. The output field displays one line before executing. The precise amount of lines displays in both fields when the randomization procedure is complete, though.

The Level of Coding; How to Create ChatGPT WordPress Plugin

The code’s overall quality was good. Only the initial response is present because any more wouldn’t fit in the article. The plugin’s dashboard user interface and processing logic written the software, which also correctly built the WordPress header block.

Even though I indicated below, it did put my summary lines above the fields, but that’s not a significant deal. It’s the same kind of error that a client may receive from a human contractor. And then needs to make some more effort to correct it.

Coding was successful, however, it didn’t follow all WordPress programming best practices. For instance, the user input wasn’t sanitized. The WordPress community is strict about input sanitization to prevent hackers from filling areas with information that might damage a website. Nevertheless, this code included no such data.

I did tell the AI to sanitize input as a subsequent test, and it did so—to a point. When calling PHP from within HTML, it did not sanitize the input, but it did sanitize the input inside the PHP function. That undoubtedly created a vulnerability for hackers.

Setting of Plugin

The menu item for the plugin also dropped into Settings. Most likely, I would have added it to the Tools section or given the function its menu item. I believe ChatGPT made a sound choice in putting the menu item because I didn’t specify where it should invoke.

I requested the AI name of the plugin in my last request. Which I appended to my prompt:

Create the “Robo Randomizer” WordPress plugin, which is compatible with PHP 8.

Strangely enough, the AI-generated a completely new plugin for me, one that offers a shortcode instead of a dashboard interface. It’s intriguing, so let me explain it to non-WordPress users.

When developing anything like this, you have the option of making it accessible to site visitors (referred to as the front end). Or users who log in to the dashboard to manage the side (the backend). Although I did not provide a frontend or backend in my original set of queries, the AI created the tool’s backend dashboard interface.

But this time, it chose to create the plugin as a frontend tool that uses a shortcode to run. In WordPress, you may include a shortcode that executes plugin code (for example, [randomize lines]) within a post. Such a shortcode was provided to me in the final AI-produced version. Which will allow site visitors to see the functionality of the randomized line.

Following this, ChatGPT seems to lose its direction. The original plugin couldn’t have any further functionality added to it, and ChatGPT primarily just kept creating the shortcode version. Code maintenance is not ChatGPT’s strongest suit.

The Consequences

This plugin is undoubtedly basic. It’s about the same size as the programming projects I handed to my first-year students at UC Berkeley. It’s not nearly as complicated as the much, much bigger open-source WordPress plugins that I look after for 50,000+ users.

Is it bad? One participant was worried that a non-programmer user would not be aware of the AI embedded harmful (or at least promotional) material in the plugin. However, the truth is that if you can’t read code and aren’t a developer, even if you work with a person, you won’t truly understand what’s within. Ultimately, you must decide whether to rely on reputation or ask someone you can trust to review the code. The code generated in my experiment was clean in this particular instance.

Is it at its highest potential? Once more, people were judging AI programming differently than even human programmers. Although I’m a skilled programmer, my code contains errors. At least initially, it’s not the greatest it can be. But as time passes, people improve the code. I doubt that an AI could take already-written code and fix, augment, and debug it. However, sometimes something simply needs to work. Even if they are the greatest of the best, it doesn’t always matter. Good enough is frequently sufficient. Additionally, it produced adequate code.

Will it lessen the demand for human programmers? Almost certainly I detest the idea of a computer taking anyone’s job, even if it’s one I would be interested in. AI is unquestionably a viable alternative for simple, short jobs, whether they include writing or programming. Paychecks for people will undoubtedly be affected.

So sure, I’m a little startled by how amazing the plugin I “built” for my wife was. As long as consumers need the kind of work that seasoned engineers and writers create, however, AI has a long way to go before it begins to displace them. And yes, my friends, I am concerned about it.


Back to Featured Articles on Logo Paperblog