Accessing directly WPDB via drivers possible?

Define “access directly”? In which context?

Basically, explain what it is that you’re trying to accomplish, not how you’re trying to do it. You get better answers that way.

OK. I would like to interact with the DB from the backend, i.e. perform CRUD operations, mainly import lots of data into the DB and specifically from Node.js.

I tried to read posts with the mysql package in Node.js and it worked fine, but I’m not sure If I can perform all CRUD operations normally like with any other DB without messing things up in WP. So, with “access directly” I mean use the drivers that each language provides to interact with MySQL.

For interacting with the DB in general I’ve found so far these methods:
1. PHPMyAdmin / Adminer
2. wpdb Object (PHP)

I have to mention that I’m somewhat familiar with JS and python, but not with PHP.

Well, the database is just a database, so you can insert data into it outside of WP if you like. WP may not understand your data if you don’t have all the IDs and such match up to what WP would do.

So, yes, you can access it directly, but without knowing specifically what you want to do to the data, nobody can really answer your question. I mean, do you want to insert posts? Create users? Without knowing specifically what you want to do, then basically all anybody can say is “yes, it is a pretty normal mysql database that you can interact with”.

@otto42 : OK. Thanks!

Then I have to try and see if it works this way.

Source link