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 [69548ff1f0 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.
See #56126.
Built from https://develop.svn.wordpress.org/trunk@53665


git-svn-id: http://core.svn.wordpress.org/trunk@53224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-07-05 16:03:13 +00:00
parent 3d05e52827
commit 228bbf3f7f
2 changed files with 3 additions and 3 deletions

View File

@ -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' ),

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-alpha-53663';
$wp_version = '6.1-alpha-53665';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.