From bee2e5e52cbefba7298e976f1da2618ec2e7f0bf Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 5 Jul 2022 16:05:11 +0000 Subject: [PATCH] Block Patterns: Update the value used for keywords. Patterns on the [https://wordpress.org/patterns/ Pattern Directory] can have keywords for better discoverability while searching. The way these are stored [https://github.com/WordPress/pattern-directory/commit/69548ff1f0326c4fd4d9ea7390c48b6d9d227055 was changed from a taxonomy to meta value], but the `/wp/v2/pattern-directory/patterns` endpoint was still pulling from that old value. The correct property to use for this field is `meta.wpop_keywords`, which returns a single string with comma-separated keywords. Props ryelle, TimothyBlynJacobs. Merges [53665] to the 6.0 branch. See #56126. Built from https://develop.svn.wordpress.org/branches/6.0@53666 git-svn-id: http://core.svn.wordpress.org/branches/6.0@53225 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../endpoints/class-wp-rest-pattern-directory-controller.php | 4 ++-- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php index 64b4ce28f1..b0ba186a02 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php @@ -206,7 +206,7 @@ class WP_REST_Pattern_Directory_Controller extends WP_REST_Controller { 'title' => sanitize_text_field( $raw_pattern->title->rendered ), 'content' => wp_kses_post( $raw_pattern->pattern_content ), 'categories' => array_map( 'sanitize_title', $raw_pattern->category_slugs ), - 'keywords' => array_map( 'sanitize_title', $raw_pattern->keyword_slugs ), + 'keywords' => array_map( 'sanitize_text_field', explode( ',', $raw_pattern->meta->wpop_keywords ) ), 'description' => sanitize_text_field( $raw_pattern->meta->wpop_description ), 'viewport_width' => absint( $raw_pattern->meta->wpop_viewport_width ), ); @@ -274,7 +274,7 @@ class WP_REST_Pattern_Directory_Controller extends WP_REST_Controller { ), 'keywords' => array( - 'description' => __( "The pattern's keyword slugs." ), + 'description' => __( "The pattern's keywords." ), 'type' => 'array', 'uniqueItems' => true, 'items' => array( 'type' => 'string' ), diff --git a/wp-includes/version.php b/wp-includes/version.php index 88798c09f0..c2df616b05 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0.1-alpha-53664'; +$wp_version = '6.0.1-alpha-53666'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.