Capitalization? I thought I tried that 🙁 . Cool though, thanks!
I've added the shortcode in the child theme function file
// to update the post slug
add_action('cred_save_data', 'func_change_post_slug', 10, 2);
function func_change_post_slug($post_id, $form_data){
if ($form_data['id']==1647) {
$slug = sanitize_title($_POST['post_slug']);
wp_update_post(array('ID'=>$post_id,'post_name' => $slug));
}
}
// to get the value of post slug
add_shortcode( "get_slug","func_get_slug");
function func_get_slug($post_id, $form_data){
if (isset($_GET['_id']) and $_GET['_id']!='' ) {
$id = $_GET['_id'];
$post = get_post($id);
return $post->post_name;
}
}
Well - dont know whats happend but I've changed the shortcode as given under:
// to get the value of post slug
add_shortcode( "get_slug","func_get_partner_slug");
function func_get_partner_slug(){
return get_post_field( 'post_name', $_GET['partner_id']);
}
I can see now it works fine - can you please confirm.
I removed some code from functions file. It's saving now.
Is it possible to set the default Post Status from current status rather than default to Publish?
And is it possible to check for duplicates on the slug when saving?
New threads created by Minesh and linked to this one are listed below: