Back in 2011, I was tasked by a client to access the WordPress users database and display that data on a WordPress page. Having solved that issue I created a video showing others how to do the same. Surprisingly, so many of you viewed the video and asked quite a lot of questions. Recently, I was asked if I could do an updated version since some of you are now using PHP 7.
So here it is, an updated (2016) version of how to run PHP code in a WordPress page or post. I’m using PHP7, and demonstrating connections using PDO and MySQLi.
Here are the code examples: