Answers for "toolset forms post status"

0

toolset forms post status

[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"}
]
}
Posted by: Guest on May-09-2020
0

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 );
}
}
Posted by: Guest on May-09-2020

Browse Popular Code Answers by Language