Unknown column error w/ wpdb->update() even though not providing that column name

I am trying to use the wpdb->update() function to update a row in a database that has a custom PRIMARY KEY. Here is my wpdb->update() code:

$column => $value
‘observation_id’ => $observation_id
‘%s’, ‘%d’
array( ‘%d’ )

but I am getting the PHP error:

WordPress database error Unknown column ‘id’ in ‘where clause’ for query UPDATE

Am I missing something? In the 3rd argument for update() I am specifying to search by “observation\_id” and not “id”. Does WordPress automatically force searching by “id” under the hood?

This is part of a custom rest\_route, which I am hitting with the AJAX Query:

url: endpoint,
type: ‘PUT’,
data: {
observation_id: parseInt(observationId),
column: columnName,
value: value
headers: {
‘X-WP-Nonce’: wpApiSettings.nonce


The weird thing is that upon refreshing the page, the value pulled from the database is the updated value sent over the rest endpoint, but the AJAX response gives a \`parsererror\`.


Thank you for your help!


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer