$wpdb:insert, more arguements in $format array than in $data
Question
I’m making some customizations for a website, and I cam across this piece of code of a theme:
$wpdb->insert(
$table_name,
array(
'user_id' => $user_id,
'search_wp_query_args' => $search_args,
'search_query_str' => $search_url,
'time' => current_time( 'mysql' ),
),
array(
'%d',
'%s',
'%s',
'%s',
'%s',
)
);
What’s the reason for having one more element in the $format array than in the $data array? In the docs it implies that those should have the same number of elements, for a 1-on-1 matching… Does it account for the primary key of the table, which isn’t in the $data array anyway though? Is this a bug or there is an explanation behind it?
0
2 months
2023-03-19T18:21:49-05:00
2023-03-19T18:21:49-05:00 0 Answers
0 views
0
Leave an answer