CRUD Operations with $wpdb — a practical guide to WordPress $wpdb CRUD with clear examples you can reuse in real projects.
WordPress Plugin Development Series (30/95). Prefer one article? Read the complete WordPress plugin development tutorial.
Short description
`insert`, `update`, `delete`, and `get_*` methods cover most custom-table CRUD needs.
CRUD helpers
global $wpdb;
$table = $wpdb->prefix . 'acme_items';
$wpdb->insert($table, ['title' => 'Hello', 'created_at' => current_time('mysql')], ['%s','%s']);
$wpdb->update($table, ['title' => 'Hi'], ['id' => 1], ['%s'], ['%d']);
$wpdb->delete($table, ['id' => 1], ['%d']);