[Resolved] Is there a way to trim the post title to a maximum no. of characters in CRED
This support ticket is created 3 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
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.
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?