Skip Navigation

[Resolved] Display custom post name like custom field1 + custom field2

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

This topic contains 1 reply, has 1 voice.

Last updated by culturaI 5 years, 11 months ago.


Hello i 'm using cred to enter custom post content.

I removed from cred form submitting of post title because i don't need the title.

When i compile the cred form post title is autogenerating like: CRED Auto Draft 372bce54fa46f7c17fa3f8d8027cefe1

I have:
custom field1=nome
custom field2=cognome

I would want the post name = nome+cognome

My request is similar to this:

I tried to add to function.php this code (don't seem to working):
if ($form_data["id"]==36)

if (isset($_POST["nome"]) && isset($_POST["cognome"]) ){

$name = $_POST["nome"]." ".$_POST["cognome"];
// Update the post into the database
$my_post = array(
'ID' => $post_id,
'post_title' => $name
wp_update_post( $my_post );

My cred ID is 36 like in the code
It's possible to achieve this?



Ok i managed the solution looking to other threads on this forum.

I post the solution here to help other users:

Auto-title custom post type like sum of custom fields (in my case nome - cognome)


function my_save_data_action($post_id, $form_data){
            // Change your CRED Form "ID" accordingly below
                //Declare the content of your variables, change "your_custom_field_slug" accordingly
                $nome = get_post_meta( $post_id, 'wpcf-nome', true );
				$cognome = get_post_meta( $post_id, 'wpcf-cognome', true );
                //collect data and define new title
                $my_post = array(
                    'ID'               => $post_id,
                    'post_title'   => $nome . '-' . $cognome,
                    'post_name' => $nome . '-' . $cognome,
                // Update the post into the database
                wp_update_post( $my_post );
    add_action('cred_save_data', 'my_save_data_action',10,2);

Don't think the code is perfect but seem to work good, post link too.

The forum ‘Types Community Support’ is closed to new topics and replies.

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