From ff56046a8d7a6eee2f1431aa02aefae63650c67c Mon Sep 17 00:00:00 2001 From: efuller Date: Fri, 27 Oct 2023 15:10:52 -0400 Subject: [PATCH 1/3] Check that termRelations isset in $attributes --- src/class-plugin-curated-posts.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/class-plugin-curated-posts.php b/src/class-plugin-curated-posts.php index 3b6a9d78..f2cb9e5d 100644 --- a/src/class-plugin-curated-posts.php +++ b/src/class-plugin-curated-posts.php @@ -56,10 +56,11 @@ public function with_query_context( array $context, array $attributes, WP_Block_ foreach ( $attributes['terms'] as $taxonomy => $terms ) { if ( taxonomy_exists( $taxonomy ) && is_array( $terms ) && count( $terms ) > 0 ) { + $operator = isset( $attributes['termRelations'] ) && is_array( $attributes['termRelations'] ) ? $attributes['termRelations'][ $taxonomy ] ?? 'AND' : 'AND'; $args['tax_query'][] = [ 'taxonomy' => $taxonomy, 'terms' => array_column( $terms, 'id' ), - 'operator' => is_array( $attributes['termRelations'] ) ? $attributes['termRelations'][ $taxonomy ] ?? 'AND' : 'AND', + 'operator' => $operator, ]; } } From a62236c6ce9dc793850dd43eee36fc3ce1c71091 Mon Sep 17 00:00:00 2001 From: efuller Date: Mon, 30 Oct 2023 08:49:44 -0400 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9def8fd7..ce48c8c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `WP Curate` will be documented in this file. +## 1.4.0 - 2023-10-30 + +- Bug fix: prevents error if `termRelations` attribute is not set. + ## 1.3.0 - 2023-10-26 - Only show the blocks and register the meta on supported post types. From c38a9111b2a4e0e699d6d6229b37892d5538cad5 Mon Sep 17 00:00:00 2001 From: efuller Date: Mon, 30 Oct 2023 08:50:18 -0400 Subject: [PATCH 3/3] Bump to version 1.4 --- wp-curate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-curate.php b/wp-curate.php index f72c32ea..b2958a35 100644 --- a/wp-curate.php +++ b/wp-curate.php @@ -3,7 +3,7 @@ * Plugin Name: WP Curate * Plugin URI: https://github.com/alleyinteractive/wp-curate * Description: Plugin to curate homepages and other landing pages - * Version: 1.3.0 + * Version: 1.4.0 * Author: Alley Interactive * Author URI: https://github.com/alleyinteractive/wp-curate * Requires at least: 6.3