Site icon Hip-Hop Website Design and Development

How to import a custom MySQL DB table into a WordPress custom post type

What I’ve done so far is create a plugin that creates a custom post type, takes a field(ID from the custom DB) and also creates a couple of page templates.

I have a custom MySQL DB that is on the same server as a WP install. What I need is to import a MySQL DB table into a WP custom post type.

I can’t figure out how to import the data itself straight from one MySQL DB to the WP using PHP. The catch is, I need this to happen whenever the custom MySQL DB is updated.

If it helps, we do have a REST API that we can use. I was just trying to make this as hands off as possible.

Any and all help is appreciated!!