I am working on a WordPress website. I have a MySQL database with data in it. I want to showcase this data on my website (I already have a local PHP page that does what I want).

I have been told that the best way to do this is to create a plugin that retrieves data from the database, but I have no idea how to make one and I can't find any tutorials that involve databases.

Any tips/pointers/links to tutorials are greatly appreciated.

  • I would like to thank the pedants who read my question intently enough to fix my truly horrendous lack of capitalization of proper nouns (that I'm sure must have obscured the meaning of the sentence - one could easily think that I was referring to some kind of fabulous machine that presses words!) but who offer absolutely no advice as to my actual question. God bless you for your invaluable aid, this SE would collapse without you Oct 14, 2019 at 12:05

1 Answer 1


To query a second database you can use the wpdb object like explained here.
This can be a local or extern database. You don't need to create a plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.