TIL about using wpdb to insert data into the WordPress Database
POSTED ON:
TAGS: wordpress
function shove_this_into_the_database() {
global $wpdb;
$tableName = $wpdb->usermeta;
$tableData = [
'user_id' => 1,
'meta_key' => "cubby_cat",
'meta_value' => "OH LAWD, he coming!"
];
$wpdb->insert($tableName, $tableData);
echo "The record has been set!";
}
Related TILs
Tagged: wordpress