Skip Navigation

[Resolved] Auto populate title from fields

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.

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/Karachi (GMT+05:00)


This is a follow up question for this topic:

I would like to auto populate the post title with some form fields: arrival date - ship name - port name



Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

Am I right in thinking that the solution you went with from the other thread was to have a reservation post type and a one-to-many relationship between ports and reservations, and another one-to-many relationship betweem ships and reservations?

And so the form you are talking about here is a form to publish reservation posts, which is shown on the port page, and which has the port pre-selected and from which a ship can be chosen. (I assume the arrival date is a field belonging to the reservation post.)

To auto-populate the post title there are two ways you might do this.

One would be to add JavaScript to your form. The post title field would be included (it is needed) but hidden, and you could add on-change event handlers to the arrival date field and the ship selector which assembles the title from the 3 field components, and then the post title will be handled normally as the form is submitted.

The alternative would be to use PHP on the server via the cred_save_data API hook. In the linked documentation there is an example of how to generate a dynamic post title (expand the example usage section):

In your case you would have the ship and port IDs available in the $_POST object and you would need to get those post objects (with get_post) to access their titles.


Hi Nigel,

Yes, that seems right. I can't write JS or PHP though, that's why I use Toolset 😉



Thanks for writing back.

If you're not comfortable writing/editing PHP and JS code for the customizations, you can consider hiring a professional from our list of recommended contractors:


This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.