Make WordPress Core


Ignore:
Timestamp:
07/05/2022 04:01:36 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Block Patterns: Update the value used for keywords.

Patterns on the Pattern Directory can have keywords for better discoverability while searching. The way these are stored 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php

    r53333 r53665  
    112112
    113113        array_walk( $patterns, array( $this, 'assertPatternMatchesSchema' ) );
     114        $this->assertSame( array( 'blog post' ), $patterns[0]['keywords'] );
     115        $this->assertSame( array( 'header', 'hero' ), $patterns[1]['keywords'] );
     116        $this->assertSame( array( 'call to action', 'hero section' ), $patterns[2]['keywords'] );
    114117    }
    115118
     
    158161
    159162        array_walk( $patterns, array( $this, 'assertPatternMatchesSchema' ) );
    160 
    161         foreach ( $patterns as $pattern ) {
    162             $this->assertContains( 'core', $pattern['keywords'] );
    163         }
    164163    }
    165164
Note: See TracChangeset for help on using the changeset viewer.