fixing php warning

This commit is contained in:
Antoine M 2024-01-24 15:35:02 +01:00
parent 849fcdade8
commit d49997d4d9

View File

@ -2,6 +2,7 @@
function homegrade_brochure_post_title_updater($post_id) function homegrade_brochure_post_title_updater($post_id)
{ {
if (!$post_id) return;
$my_post = array(); $my_post = array();
$my_post['ID'] = $post_id; $my_post['ID'] = $post_id;
@ -9,10 +10,8 @@ function homegrade_brochure_post_title_updater($post_id)
$fields = get_fields($post_id); $fields = get_fields($post_id);
if (!$fields) return; if (!$fields) return;
$brochureTaxonomy = $fields['publications_taxonomy']; $brochureTaxonomy = $fields['publications_taxonomy'] ?? null;
if (!$brochureTaxonomy) return;
if (!$post_id) return;
if (get_post_type() == 'brochures') { if (get_post_type() == 'brochures') {
$my_post['post_title'] = ""; $my_post['post_title'] = "";