Make WordPress Core


Ignore:
Timestamp:
07/06/2022 04:26:08 PM (4 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.

Follow-up to [51021].

Props ryelle, TimothyBlynJacobs.
Merges [53665] to the 5.8 branch.
See #56126.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php

    r51208 r53675  
    101101
    102102        array_walk( $patterns, array( $this, 'assertPatternMatchesSchema' ) );
     103        $this->assertSame( array( 'blog post' ), $patterns[0]['keywords'] );
     104        $this->assertSame( array( 'header', 'hero' ), $patterns[1]['keywords'] );
     105        $this->assertSame( array( 'call to action', 'hero section' ), $patterns[2]['keywords'] );
    103106    }
    104107
     
    147150
    148151        array_walk( $patterns, array( $this, 'assertPatternMatchesSchema' ) );
    149 
    150         foreach ( $patterns as $pattern ) {
    151             $this->assertContains( 'core', $pattern['keywords'] );
    152         }
    153152    }
    154153
Note: See TracChangeset for help on using the changeset viewer.