Q:

toolset forms post status

add_action('cred_save_data', 'change_post_status',10,2);
function change_post_status($post_id, $form_data) {
 
if ($form_data['id']==9999){
$my_post['ID'] = $post_id;
$my_post['post_status'] = $_REQUEST['post_status'];
// Update the post into the database
wp_update_post( $my_post );
}
}
0
[cred-generic-field field="post_status" type="select" class=""]
{
"required":0,
"validate_format":0,
"default":["publish"],
"options":[
{"value":"draft","label":"draft"},
{"value":"publish","label":"publish"}
]
}
0

New to Communities?

Join the community