Update Multiple Post Meta for the Same Post In One call?
Question
How can I update multiple fields/Custom fields for the same post using only one call?
Everything I came across are cases of multiple calls of “update_post_meta”, for each of the fields.
Is there a way to pass the data using an array, to update multiple post meta values (for the same post) using only one call?
I am trying the following but it doesn’t seem to work, is it even possible to update multiple meta using the “wp_update_post”?
$New_Meta = array
(
'Client_Name' => $Client_Name_Edit,
'Client_Type' => $Client_Type_Edit,
);
wp_update_post(array(
'ID' => $Post_ID,
'post_name' => $Client_Name_Edit,
'post_title'=> $Client_Name_Edit,
'meta_input'=> $New_Meta,
));
}
Many thanks in advance
0
php, plugin-development, plugins, post-meta, theme-development
2 years
2020-07-28T17:10:35-05:00
2020-07-28T17:10:35-05:00 0 Answers
57 views
0
Leave an answer