When we create custom posts, sometimes the creator needs to give the post a really long title.
That's fine, but the URL (which gets generated from the post title) is uncomfortably long.
Ideally, is there a way, either through ToolSet natively or through some custom code, to limit the number of characters in the URL?
I don't care too much if words get cut off.
Alternatively, is there a way to construct the URL from the post ID?
Hello. Thank you for contacting the Toolset support.
As I understand - you want to adjust the post slug when you save the post but I would like to know that when you want to adjust the post slug - while using Toolset Forms or when you create a new post from admin?
Where:
- You can replace 9999 with your original form ID.
- you can adjust the code as required as currently it will generate the post slug based on time and md5() function.
The thing is that post slug (name) we need to keep it unique.
So, trimming the slug will not help as lets say user create a post with post title "Test 1" and another user also create post with title "Test 1" in this case the post title will be identical and we will require to make the post title unique.
What I would prefer is:
a) take the user input title from the CRED form
==>
The post title field will be already available with the form.
b) trim it to a maximum number of characters
==>
How do you want to trim that, to what number?