From 7d28cfce9ab66856fa3d8d243cb0f798a90f8855 Mon Sep 17 00:00:00 2001 From: Mike Sheppard Date: Tue, 26 Jan 2021 16:28:46 +0000 Subject: [PATCH] Fix "Only variables should be passed by reference" error --- src/Crumb.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Crumb.php b/src/Crumb.php index ac32c6d..fd5224c 100644 --- a/src/Crumb.php +++ b/src/Crumb.php @@ -167,11 +167,10 @@ public function build() } if (is_singular('post')) { - $category = array_shift( - get_the_category(get_the_ID()) - ); + $categories = get_the_category(get_the_ID()); - if (! empty($category)) { + if (! empty($categories)) { + $category = array_shift($categories); $this->add( $category->name, get_category_link($category),