Skip Navigation

[Resolved] Hook 'cred_save_data' seems not working

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

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 16 replies, has 2 voices.

Last updated by Minesh 5 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#1444681

Great!
I've added only "OR" condition fot the edit section and it works!
Thank You very much!

<?php
/**
 * New custom code snippet (replace this with snippet description).
 */

toolset_snippet_security_check() or die( 'Direct access is not allowed' );

// Put the code of your snippet below this comment.

add_action('cred_save_data','auto_titolo_fascicolo_frontend',30,2);
function auto_titolo_fascicolo_frontend($post_id,$form_data) {
    if (($form_data['id']==374) OR ($form_data['id']==417)) {
        $title ="";
        
       // $rivista_id = toolset_get_related_post( $post_id, $relationship='wpcf-rivista-fascicolo' );
        $rivista_id = $_POST['@rivista-fascicolo_parent'];
        $rivista = get_the_title($rivista_id); 
        $anno_solare = get_post_meta($post_id, 'wpcf-fascicolo-anno-solare', true);
        $numero_fascicolo = get_post_meta($post_id, 'wpcf-fascicolo-numero', true);
        $title= $rivista . ' | ' . $anno_solare . ' | N. ' . $numero_fascicolo;
        $args = array(
        'ID' => $post_id,
        'post_title' => $title,
        'post_name'  => sanitize_title( $title )
        );

        wp_update_post($args);
    }
}
#1444737

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Great - glad to help.

Please feel free to close the ticket.