Tell us what you are trying to do?
I tried to follow the past support solutions to code that cannot be executed.
Is there any documentation that you are following?
https://toolset.com/forums/topic/add-auto-generate-post-title-from-fields/
Is there a similar example that we can see?
/**
* Auto-generate post title
*/
function trace_autogenerate_title( $post_id, $post ){
if ( 'bildungsangebot' == $post->post_type ) {
$pd_sku = get_post_meta( $post_id, 'wpcf-product_sku', true );
$pd_sn = get_post_meta( $post_id, 'wpcf-serial_number', true );
$new_title = $pd_sku . " " . $pd_sn . " " .$post_id ;
$new_title = sanitize_text_field( $new_title );
$new_slug = sanitize_title( $new_title );
$args = array(
'ID' => $post_id,
'post_title' => $new_title,
'post_name' => $new_slug
);
// unhook this function so it doesn't loop infinitely
remove_action('save_post', 'trace_autogenerate_title',30,2);
// update the post, which calls save_post again
wp_update_post( $args );
// re-hook this function
add_action('save_post', 'trace_autogenerate_title',30,2);
}
}
add_action( 'save_post', 'sha_autogenerate_title', 30, 2 );
What is the link to your site?
removed