How to update the custom post_type custom fields? Is it possible using wp_update_post ?
In this function's arguments I couldn't find post_type. Is wp_update_post the right function for the purpose? Thanks for the help in advance.
I have custom post type crb_expense. I would like to update it's title, content, custom fields and taxonomy related with it. Here I just test if it works only with title and the content:
if ( isset( $_GET['edit'] ) && $_GET['edit'] != 0 ) {
wp_update_post( [
'ID' => $_GET['edit'],
'post_type' => 'crb_expense',
'post_title' => 'This is the new post title.',
'post_content' => 'This is the new updated content.',
] );
}
. $_GET['edit'] contains the id of the post which is comming from ajax request. I have cheched it and the id is correct.
wp_update_post? be more detailed - Samvel Aleqsanyanupdate_post_meta($id,'fieldkey', $_REQUEST['fieldvalue']);- Vignesh Pichamani