WordPress mysqli and PDO

Does WordPress code base use mysqli or PDO?

I know PDO is superior to mysqli but mysqli is not bad neither. Plus from one of the features of what makes PDO is superior to mysqli ( that is being database agnostic ) does not mean much to WordPress as WordPress will always use mysql server. But binding params with data types is something PDO supports but mysqli does not and it’s a good thing.

My guts tell me that WordPress does use mysqli but I could not see it in the code base yet.

My second question is if WordPress is using mysqli, is it because of speed concerns or is it because back in the earlier days (when WP was being developed), PDO wasn’t just there yet?


WordPress uses mysql_* functions.


It has used those ever since I can remember, which probably answers your last question. It is what I would consider legacy code. I suspect it will be updated sometime soon (those functions were only deprecated as of PHP 5.5, I believe). I don’t know which route development will go.

Link to a ticket in Trac, courtesy of Wyck (from a comment below):


Leave a Comment