Skip Navigation

[Closed] Post naming with related post titles

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)

Author
Posts
#2692540

I'm using that custom code to custom the post name.

3 CPT's: DELIVERY, COMPANY, MOVIE.
2 relationships 1toM (movie-delivery) and (company-delivery).

1 form to create the DELIVERY posts.

The issue is that this script do not retrieve the parents titles as expected. Instead it gives me twice the form name.
Could you please help me to solve this ?

add_action('cred_save_data', 'func_add_delivery_title', 10, 2);

function func_add_delivery_title($post_id, $form_data)

{
if (in_array($form_data['id'], [1072, 1038])) {

$delivery_post_id = $post_id;
$delivery_post_date = get_the_date('d-m-Y', $delivery_post_id);

$film_parent = isset($_POST['@movie-delivery.parent']) ? $_POST['@movie-delivery.parent'] : '';
$company_parent = isset($_POST['@company-delivery.parent']) ? $_POST['@company-delivery.parent'] : '';
$film = get_the_title($film_parent);
$company = get_the_title($company_parent);

$title = $film . '_'. $company . '_'. $delivery_post_id . '--' . $delivery_post_date;

$args = array('ID' => $post_id, 'post_title' => $title, 'post_name' => sanitize_title($title));
wp_update_post($args);
}
}

#2692605

Hi,

Thank you for contacting us and I'd be happy to assist.

To troubleshoot this, I'll need to see how this form and the relationships are set up in the admin area.

Can you please share temporary admin login details, along with the link to the page with this form?

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2692609

Hi Waqar.

I'm working locally with MampPro. How can we proceed ?

#2692611

In that case, you can share a clone/snapshot of your website, as explained in this guide:
https://toolset.com/faq/provide-supporters-copy-site/

I've set your next reply as private again.

The topic ‘[Closed] Post naming with related post titles’ is closed to new replies.