hello, i have been working on a website, will have 3 post type “Schools”, “Departments” & “Programs”. Each schools will have relations field for “Departments”. Each departments will have relations field for “Programs”.
Is there way to make the Departments url will have the current schools slug? Means if i click on a Department title on a schools page will have the url Like: /website/school-name/department-name
And for Programs. if user click on a program title on the Department page opens from above, the url will be : /website/school-name/department-name/program-name

Trying to achieve the same.
I have a post type artists => artist lastname & artist first name field
and Post Type exhibitions.
There’s a bidirectional relationship field, which connects exhibitions to artists.
I want to create a Slug/post-name which is …/[first 3 letters of the 1st artist’s last name]-[exhibition name].
//Generiert bzw. ersetzt Title&Slug der Ausstellungen automatisch von ACF field Ausstellungstitel. Slug von 1.Künstler
function ausstellungs_title_updater( $post_id ) {
$my_post = array();
$my_post['ID'] = $post_id;
$my_post['post_name'] = $post_name;
$ausstellungstitel = get_field('_ausstellungen_titel');
$kuenstlerabk1 = get_field ('_ausstellungen_to_kuenstlerinnen_bez');
if ( get_post_type() == 'ausstellungen' ) {
$my_post['post_title'] = get_field('_ausstellungen_titel');
$my_post['post_name'] = sanitize_title($kuenstlerabk1 . $title );
}
// Update the post into the database
wp_update_post( $my_post );
}
// run after ACF saves the $_POST['fields'] data
add_action('acf/save_post', 'ausstellungs_title_updater', 20);
I have used this above example to firstly only insert the exhibition title “ausstellungen_title”, which worked perfectly.
Adding:
$kuenstlerabk1 = get_field ('_ausstellungen_to_kuenstlerinnen_bez');
gives me now only array as slug name.
I have to somehow get the “_ausstellungen_to_kuenstlerinnen_bez”, which is the relationship field to output the slug of the first artist attached.
Any ideas? THANK You!
You need to add a custom permalink structure, see this article starting at step 3 https://1fix.io/blog/2016/02/05/parent-from-another-cpt/