From d605dbc1a66901de6e9633c8985c37b0b81eac23 Mon Sep 17 00:00:00 2001 From: Parham Ghaffarian <1007718+ParhamG@users.noreply.github.com> Date: Tue, 1 Oct 2024 03:53:55 +0300 Subject: [PATCH] Fix the `category_slugs` format in the Patterns API This fixes a regression caused via https://github.com/WordPress/pattern-directory/pull/704 that returns category_slugs as an object instead of an array --- .../plugins/pattern-directory/includes/pattern-post-type.php | 1 + 1 file changed, 1 insertion(+) diff --git a/public_html/wp-content/plugins/pattern-directory/includes/pattern-post-type.php b/public_html/wp-content/plugins/pattern-directory/includes/pattern-post-type.php index 2f48b50b..45c01e67 100644 --- a/public_html/wp-content/plugins/pattern-directory/includes/pattern-post-type.php +++ b/public_html/wp-content/plugins/pattern-directory/includes/pattern-post-type.php @@ -295,6 +295,7 @@ function register_rest_fields() { $slugs = wp_list_pluck( wp_get_object_terms( get_the_ID(), 'wporg-pattern-category' ), 'slug' ); $slugs = array_map( 'sanitize_title', $slugs ); $slugs = array_diff( $slugs, [ 'featured' ] ); + $slugs = array_values( $slugs ); return $slugs; },