Skip Navigation

[Resolved] How to make url something besides cred/autodraft-#########

This thread is resolved. Here is a description of the problem and solution.

Problem:

Setup the post slug in Toolset post forms.

Solution:

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

Relevant Documentation:

This support ticket is created 2 years, 8 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.

Our next available supporter will start replying to tickets in about 4.40 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 10 replies, has 2 voices.

Last updated by chrisO-12 2 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#2312737

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

#2312903

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/

#2313499

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?

#2313763

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

#2313767

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?

#2313769

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

#2313777

Thank you! I will try this tomorrow.

#2313933

I have marked this thread as "Waiting for feedback" status, please update here if you need more assistance for it.

#2315863

I see an auto-close message. please keep this open until I resolve another issue before confirming that the proposed solution will work.

#2316027

have marked this thread as "Waiting for feedback" status, please update here if you need more assistance for it.

#2317653

My issue is resolved now. Thank you!