Skip Navigation

[Resolved] Generate post title from multiple custom fields entries

This support ticket is created 5 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.

This topic contains 2 replies, has 2 voices.

Last updated by esmondR 5 years, 3 months ago.

Author
Posts
#1356179

Tell us what you are trying to do? i want to create a post title using multiple custom field entries from the post. So title would be 'customer'-'manufacturer'-'make'-'model' if those were all separate custom fields.

Is there any documentation that you are following? https://wordpress.stackexchange.com/questions/94364/set-post-title-from-two-meta-fields

I am using the code at the bottom which works for one field, but not sure how to adapt it to use multiple custom fields

Is there a similar example that we can see?

What is the link to your site? - hidden link

#1356213

This is possible by applying some custom code to the cred_save_data or save_post hooks

We have a working example of such a code here:
hidden link

It updates the post title with a date coming from a Date Post Field created with Types.
Similarly you can take any Field value and update the Post title with it.

There is another example with a similar logic here:
https://pastebin.com/2BTbVbcs

The Hooks used here is cred_save_data, means this happens when a Toolset Form is submitted.
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

If you want this to happen when the post saved in the Backend of WordPress, you can use https://codex.wordpress.org/Plugin_API/Action_Reference/save_post

To use multiple values in a PHP variable and connect them you can use the dot (.), see https://stackoverflow.com/questions/6484968/what-does-a-dot-do-in-php

#1356781

My issue is resolved now. Thank you!