handling erro case when no $thematique of get the term for admin classes
This commit is contained in:
parent
9341034635
commit
04dc28af1c
|
|
@ -267,9 +267,11 @@ function wpdocs_admin_classes($classes)
|
|||
global $post;
|
||||
|
||||
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0] ?? null;
|
||||
if (!$thematique) return $classes;
|
||||
|
||||
$thematiqueParent = getParentThematique($thematique);
|
||||
$thematiqueColorSlug = getThematiqueFamilySlug($thematiqueParent->slug) ?? null;
|
||||
$postType = get_post_type($post->ID);
|
||||
$thematiqueColorSlug = getThematiqueFamilySlug($thematiqueParent->slug);
|
||||
$postType = get_post_type($post->ID) ?? null;
|
||||
|
||||
if (in_array($pagenow, array('post.php', 'post-new.php'), true) && $thematiqueColorSlug && ($postType == 'conseils' || $postType == 'questions')) {
|
||||
$classes .= ' ' . $thematiqueParent->slug;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user