handling location and date for post title updater
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Antoine M 2024-11-22 10:31:08 +01:00
parent e7fee252e4
commit dff2a50c35

View File

@ -42,16 +42,15 @@ function metiers_patrimoine_chantiers_post_updater($post_id)
if (!$artisan || !$chantier_name) return;
$my_post['post_title'] = "";
$title = $artisan . " | " . $chantier_name;
$title = $artisan->post_title . " | " . $chantier_name;
if ($localisation) {
$title .= " | " . $localisation;
if ($localisation && isset($localisation['city'])) {
$title .= " | " . $localisation['city'];
}
if ($date) {
// $title .= " | " . ;
$title .= " | " . $date;
}
$my_post['post_title'] = $title;
wp_update_post($my_post);
}
add_action('acf/save_post', 'metiers_patrimoine_chantiers_post_updater', 20);