Which language is best for wordpress blog automation

Hey guys?
Which language is best for wordpress blog automation using openai?
Depends how you're looking to do it and what you're comfortable with, really. Any language can work fine, so the best one is the one you have most experience with,

But if I was pushed, I'd say that the OpenAI python library is probably the easiest one to use. And Python is probably the best language for automation as well. So if you just generate an application password to interact with your site via the WordPress API then Python would be the best language to build it in. You could even build it as a desktop application that is set to run at different times of the day.

The other way is to do it directly within WordPress using PHP in a plugin, better as it's direct integration and you can use CRON jobs to set it to run at different times of the day, but the library isn't an official library. So you either need to code the API connection yourself or use an unofficial library to create it.
 
Hey guys?
Which language is best for wordpress blog automation using openai?
If you don't want to use xml-rpc of wordpress, you will need to use Php because that's the only language you can make plugins with in wordpress.

Otherwise you can use python. Openai has an official openai client for python.
 
Hey guys?
Which language is best for wordpress blog automation using openai?
WP uses mysql as you probably already know. Their db structure is not that hard to learn. Which means… you can use anything that can connect to mysql… python, golang, rustlang, php, node.js - anything.
 
WP uses mysql as you probably already know. Their db structure is not that hard to learn. Which means… you can use anything that can connect to mysql… python, golang, rustlang, php, node.js - anything.
The only issue with that is that you don't really want to be interacting with the WP SQL database without going through WP. So it's either going to be best to creae a plugin with PHP to directly interact with it, or to interact with the WP database through the WP API. The API is very simple to learn and you can directly post blog posts with header tags and images included. So I'd probably go down the Python route.
 
Hey guys?
Which language is best for wordpress blog automation using openai?
my point of view, wordpress blog automation for javascript is the best language, alongwith APIs & markup (a.k.a. JAMstack" & also python language , php etc
 
The only issue with that is that you don't really want to be interacting with the WP SQL database without going through WP. So it's either going to be best to creae a plugin with PHP to directly interact with it, or to interact with the WP database through the WP API. The API is very simple to learn and you can directly post blog posts with header tags and images included. So I'd probably go down the Python route.
Why, if I may ask?

There is nothing wrong with directly communicating with the database imho, unless you are not familiar with mysql in general.

While the api is simple, it can take more than one call to fetch some of the information (if I got that right), which in my opinion is wasteful. I could achieve the same with a join or a sub query depending on the situation. I don’t need to use a “general” api. Besides, you will be saving a trip from the db to the php runtime if you connect directly to mysql , which will be faster (more so if your site has an external db, which many shared hostings have).
 
Last edited:
Why, if I may ask?

There is nothing wrong with directly communicating with the database imho, unless you are not familiar with mysql in general.

While the api is simple, it can take more than one call to fetch some of the information (if I got that right), which in my opinion is wasteful. I could achieve the same with a join or a sub query depending on the situation. I don’t need to use a “general” api. Besides, you will be saving a trip from the db to the php runtime if you connect directly to mysql , which will be faster (more so if your site has an external db, which many shared hostings have).
I get where you're coming from, but there are a lot of reasons why I'd avoid direct database calls. WordPress has built-in database security features which help protect against SQL injection and other database vulnerabilities. In my opinion, unless you really know what you're doing with SQL (which you clearly do), you should go through WordPress.

You're also risking issues down the line when WordPress updates come out. 90% of the time, it won't be a problem, but that 10% of the time can be website-breaking if you're making direct updates to the database. Especially if you're not extremely familiar with the structure of a WordPress database. Going through the WordPress API means that you're less likely to have a problem when WordPress updates are released. And, if the update does affect your methods for updating the website, it isn't going to break the website.

Plus, you're adding a layer of complexity into the process if you're planning on setting this up multiple websites. You'll need to know what the prefix is for each database, and amend this for each website you set up. If you build a WordPress plugin, or interact with the WordPress API, you don't have to worry about this as WordPress will take care of it for you.

I get that there's an efficiency trade-off, but in my opinion, it's worth losing a bit of efficiency when you're interacting with a WordPress database. It adds more work and more potential problems for a small efficiency gain. I do understand your perspective, it's just not a route I would personally take.
 
I get where you're coming from, but there are a lot of reasons why I'd avoid direct database calls. WordPress has built-in database security features which help protect against SQL injection and other database vulnerabilities. In my opinion, unless you really know what you're doing with SQL (which you clearly do), you should go through WordPress.

You're also risking issues down the line when WordPress updates come out. 90% of the time, it won't be a problem, but that 10% of the time can be website-breaking if you're making direct updates to the database. Especially if you're not extremely familiar with the structure of a WordPress database. Going through the WordPress API means that you're less likely to have a problem when WordPress updates are released. And, if the update does affect your methods for updating the website, it isn't going to break the website.

Plus, you're adding a layer of complexity into the process if you're planning on setting this up multiple websites. You'll need to know what the prefix is for each database, and amend this for each website you set up. If you build a WordPress plugin, or interact with the WordPress API, you don't have to worry about this as WordPress will take care of it for you.

I get that there's an efficiency trade-off, but in my opinion, it's worth losing a bit of efficiency when you're interacting with a WordPress database. It adds more work and more potential problems for a small efficiency gain. I do understand your perspective, it's just not a route I would personally take.
Hmm I respect your opinion, but I am on the opposite side of the spectrum because wp is nasty when it comes to security holes. I love it as a cms, no issue. But I don't like to have wordpress handle any end user accessible part of my app (wp admin can be locked up with rewrite rules). I would much rather use a static site generator for that.

As for sql injection, yes that's why you should first understand what you are doing, if you are going mysql route. If he/she doesn't understand how to parameterize a sql query, (s)he should probably not be making websites to begin with lol.

But I guess in this case the OP is trying to do some data entry to the blog (AI generated posts?) which is not user facing anyway.

Also, it does not add complexity in my opinion. It only removes one. Less moving parts, less things to fail.
 
my suggestion is python, easy to implement automation with that
 
Back
Top