Working with Databases in WordPress
read more
Categories

Working with Databases in WordPress


Out of the box, WordPress provides tons of functions that can be used to interact with the database. In most cases, the WP_Query class and related functions such as wp_insert_post, update_post_meta, get_posts will be sufficient to get the job done. However, there will be times that we’re required to do something that is not provided by WordPress natively, especially when we need to deal with custom tables.

In this tutorial, we’ll walk through the most important class to deal with databases in WordPress – wpdb, including a few tips and tricks that can be implemented in our development workflow later on. We’ll also touch on dbDelta that can be used to create custom tables in our plugin.