From f160afa9f1791eaf7c885dc805e9941df328d29f Mon Sep 17 00:00:00 2001 From: Elisa Losito Date: Fri, 11 Dec 2020 11:22:36 +0100 Subject: [PATCH] fix: :bug: fixed terms meta --- Malini/Decorators/WithTaxonomies.php | 28 ++++++++++++++-------------- Malini/Malini.php | 2 +- malini.php | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Malini/Decorators/WithTaxonomies.php b/Malini/Decorators/WithTaxonomies.php index bdfd475..0dc6a2b 100644 --- a/Malini/Decorators/WithTaxonomies.php +++ b/Malini/Decorators/WithTaxonomies.php @@ -31,21 +31,21 @@ public function decorate(Post $post, array $options = []): Post $terms = []; foreach ($post_taxonomies as $taxonomy) { $terms_by_taxonomy = get_the_terms($wp_post->ID, $taxonomy); - if (isset($options['options']) && in_array('add_term_meta', $options['options'])) { - $terms_by_taxonomy = array_map( - function($term) { - $term_meta = get_term_meta($term->term_id); - if (!empty($term_meta)) { - foreach ($term_meta as $key => $value) { - $term->{$key} = $value; - } - } - return $term; - }, - $terms_by_taxonomy - ); - } if (is_array($terms_by_taxonomy)) { + if (isset($options['options']) && in_array('add_term_meta', $options['options'])) { + $terms_by_taxonomy = array_map( + function($term) { + $term_meta = get_term_meta($term->term_id); + if (!empty($term_meta)) { + foreach ($term_meta as $key => $value) { + $term->{$key} = $value; + } + } + return $term; + }, + $terms_by_taxonomy + ); + } if (isset($options['options']) && in_array('show_taxonomy_key', $options['options'])) { $terms[$taxonomy] = $terms_by_taxonomy; } else { diff --git a/Malini/Malini.php b/Malini/Malini.php index 0b19c6e..071a2fc 100644 --- a/Malini/Malini.php +++ b/Malini/Malini.php @@ -7,7 +7,7 @@ class Malini { - public const VERSION = '1.1.2'; + public const VERSION = '1.1.3'; protected static $instance = null; diff --git a/malini.php b/malini.php index 99f9287..098ee9d 100644 --- a/malini.php +++ b/malini.php @@ -10,7 +10,7 @@ * Plugin Name: Malini * Plugin URI: https://github.com/caffeinalab/malini * Description: Malini is an extensible content decoration and normalization library for WordPress entities. - * Version: 1.1.2 + * Version: 1.1.3 * Author: Caffeina * Author URI: https://caffeina.com * Text Domain: malini