From 060ed90ba6ad2a153d1b6085a5c3137a6996f750 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Mon, 30 Sep 2024 15:58:34 -0400 Subject: [PATCH] Patterns API: Omit the "featured" category in the REST API (#704) --- .../plugins/pattern-directory/includes/pattern-post-type.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 fb4e85d3..2f48b50b 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 @@ -293,8 +293,10 @@ function register_rest_fields() { array( 'get_callback' => function() { $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' ] ); - return array_map( 'sanitize_title', $slugs ); + return $slugs; }, 'schema' => array(