Home›Toolset Professional Support›[Resolved] Split: I neeed to set a Duplicate Post link on front end (no user access admin pages) – update post slug for duplicated post
[Resolved] Split: I neeed to set a Duplicate Post link on front end (no user access admin pages) – update post slug for duplicated post
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Hi Manesh,
There is another element to fix, in order to complete this functionality :
- when duplicating, the permalink/slug of the duplicated Objet is set to : copie-source-objet-name
- then, when updating the Object Title, thre permalink stays the same, and is not updated to the new objet name
Is there a way to update the parmalink/slug of the new Objet on the publication form (without access to the admin dashboard) ?
This is a necessary, indispensable functionality. Thank you for helping me achiev it.
Best regards,
Hi Minesh,
No, my client does not have access to the backend admin - that is the whole purpose on the user interface I am building, simplified and customized precisely for the client to use :
- therefore I need to be able to update the post slug on the front end post form (the one visible on the screen capture I uploaded above)
- or in any other way on the front end...
Can you please share problem URL where exactly I can see the form?
- Do you mean I will have to click on the link "modifier base"?
By the way, why isn't there, in the custom fields group interface, a field for the post's slug ?
==>
post slug (post_name) is native WordPress post field and we can not treat as custom field.
To get to the form, click the link "Modifier base" :
- you'll get to the form on the Front end
To get to the editing template containing the form : hidden link
Regarding a field for the post slug :
- I understand that it is a native field and I reword my question :
- why is there no slug field in the Post Form admin page, in the "Post Elements" list (see attached screen capture)
To get to that Objet Form "Modifier Base Objet Confrérie" : hidden link
Can you please share admin access details as the admin access details shared before is not working at this end.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I've added the following Toolset form's hook to the "Custom Code" section offered by Toolset to update the post slug when form is saved.
=> hidden link
add_action('cred_save_data', 'func_update_object_post_slug', 10, 2);
function func_update_object_post_slug($post_id, $form_data) {
if ($form_data['id']==18806) {
$post_title=$_POST['post_title'];
$slug = sanitize_title($post_title);
wp_update_post(array('ID'=>$post_id,'post_name' => $slug));
}
}
Yes, it is working as exspected. Thank you very much. Gosh, I am learning so much...
I had totally forgotten the possibity to set up custom code in Toolset :
- if I want to apply the Duplicate Custom Post functionality/shortcode to another entity, for instance Createur,
- would it be correct to modify the custom code you added in the following way ? :
--- the Createur Form ID is : 18580)
--- if ($form_data['id']==18806 || $form_data['id']==18580) {
$post_title=$_POST['post_title'];
$slug = sanitize_title($post_title);
wp_update_post(array('ID'=>$post_id,'post_name' => $slug));
}
I suppose that the function (in Snippets plugin) and the shortcode [duplicate_post_link] can be used as they : right?
Thank you for answering these 2 questions regarding that Duplication functionality.
Best regards,
Thank you very much for all your help for this Duplication issue : I learned a lot...
The functionality works very well, and I know now tht I can apply it to other Custom Types and Forms.