Tell us what you are trying to do?
I have created a content template for a post type (user profile) that uses the users First Name_Last Name as the heading for the post. The post title field is not used. When a post (user profile) is viewed, the post slug/url is like hidden link................cred-auto-draft-e31f1d7cb3761b27ca7ea770bf5b1bba/.
How can this be changed to something that is meaningful - https:/............user-profile/FirstName-LastName or similar?
I assume that the URL containing cred-auto-draft-e31f1d7cb3761b27ca7ea770bf5b1bba/ is meaningless with respect to SEO or search capability.
What is the link to your site?
staging site
Hello,
That is expected result, if you don't setup the post title, Toolset Forms plugin will setup the post slug as you mentioned above: cred-auto-draft-****
In your case, you can try with custom codes, for example:
1) After user submit the post form, use action hook "cred_save_data" to trigger a PHP function,
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
2) In this PHP function, get those custom fields values:
- First Name
- Last Name
https://developer.wordpress.org/reference/functions/get_post_meta/
And update post slug as what you want:
https://developer.wordpress.org/reference/functions/wp_update_post/
Thanks Lou. I am not a programmer, so would need some help with this.
As an alternative, possibly adding the post title to the custom post type, and just changing the label to "Name". Would this get rid of the cred-auto-draft-#### as the post slug?
Since it is a custom codes issue, please provide a test site with the same problem, fill below private message box with login details, also point out the problem page URL and form URL, I need a live website to test and debug
Hi Luo,
I copied this from the prior reply that I sent.
"As an alternative, possibly adding the post title to the custom post type, and just changing the label to "Name". Would this get rid of the cred-auto-draft-#### as the post slug?"
If so, I can try this before any custom code is added. This would possibly eliminate the need for the code.
Will this work?
Yes, you are right, you just need to add the post title field into the post form, and change the label to name, it should be able to setup the post slug too
Thank you! I will try this tomorrow.
I have marked this thread as "Waiting for feedback" status, please update here if you need more assistance for it.
I see an auto-close message. please keep this open until I resolve another issue before confirming that the proposed solution will work.
have marked this thread as "Waiting for feedback" status, please update here if you need more assistance for it.
My issue is resolved now. Thank you!