Tell us what you are trying to do?
Trying to create a post title for a child post from four elements ({Parent-post ID}{"-"}{date timestamp from new child post}{Custom field value from new child post}).
The Parent post "company profiles" already exists and this is to be inserted into the form creating the child post.
The Child post is "funding-events", the relationship is "company-profile_funding-event"
The date field is 'funding-event-date'
The other custom field is 'funding-amount'
I used the same title format to import a large number of child posts so as to ensure each had a unique title for importing purposes (using WPAllimport) so I now need to figure out how to create posts with the same title format.
I am not a programmer but have been able to figure out parts of the puzzle.
I know this is not quite right.. esp the parent post id and timestamp date, your assistance would be greatly appreciated.
add_filter('cred_save_data','combine_title');
function combine_title($post_id) {
$type = get_post_type($post_id);
if ($type == 'funding-event') {
$title .= $post_id . ' - ' . get_post_meta ($post_id, company-profile_id = $_POST['@company-profile_funding-event'] );
$title .= ' ' . get_post_meta($post_id, 'funding-event-date', true);
$title .= ' ' . get_post_meta($post_id, 'funding-amount', true);
$slug = sanitize_title($title)
wp_update_post(array('ID' => $post_id, 'post_title' => $title, 'post_name' => $slug));
}
}
Is there any documentation that you are following?
https://toolset.com/forums/topic/cred-saving-user-submitted-custom-field-as-post-title/#post-75805
https://toolset.com/documentation/programmer-reference/cred-api/
https://toolset.com/forums/topic/cred-creating-content/
Is there a similar example that we can see?
What is the link to your site?
hidden link