From e940f4b1f1252028dbe089aa8d435a2513863214 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Mon, 22 Jul 2024 17:49:11 -0400 Subject: [PATCH] Patterns API: Omit the "featured" category in the REST API --- .../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(