Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#56126 closed defect (bug) (fixed)

Pattern keywords are not passed through from pattern directory

Reported by: ryelle's profile ryelle Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.0.1 Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-patch needs-testing has-testing-info fixed-major
Focuses: Cc:

Description

Patterns on the Pattern Directory can have keywords for better discoverability while searching. The way these are stored was changed, but the /wp/v2/pattern-directory/patterns endpoint is still pulling from that old value.

The result is that patterns loaded remotely are not registered with any keywords.

To reproduce

  • Use a theme with a theme.json
  • Add heading-large-text-and-link to the patterns list (example)
  • That pattern has the keyword "big text"
  • Open the editor, open the inserter
  • Try searching for "big text"
  • No results, when it should show the "Heading, large text, and link" pattern

Change History (16)

This ticket was mentioned in PR #2935 on WordPress/wordpress-develop by ryelle.


2 years ago
#1

  • Keywords has-patch added

The property returned from the API for "keywords" has been updated from a taxonomy to meta value, so the keyword_slugs will not return the expected content. The correct property to use for this field is meta.wpop_keywords, which returns a single string with comma-separated keywords.

Note: I'm making this change here, rather than updating keyword_slugs in the wp.org API's response, because the keywords are not "slugs", they're regular human-readable phrases. That property was also used for the "core" keyword taxonomy term, which is a format we're not using anymore (see https://github.com/WordPress/pattern-directory/commit/69548ff1f0326c4fd4d9ea7390c48b6d9d227055). If it's preferred to update it in wp.org anyway, I can make that change.

To test

  • Use a theme with a theme.json
  • Add heading-large-text-and-link to the patterns list (example)
  • That pattern has the keyword "big text"
  • Open the editor, open the inserter
  • Try searching for "big text"
  • The "Heading, large text, and link" pattern should appear

Trac ticket: https://core.trac.wordpress.org/ticket/56126

#2 @TimothyBlynJacobs
2 years ago

I don't have a strong objection to changing the way the Core endpoint works. But it does mean users on older WP versions won't automatically get a fix if the .org response was adjusted.

Might be better to put this in a point release and potentially backport it?

#3 @ryelle
2 years ago

Yeah, I'm happy to have this in a point release & backport it (though I don't know how that process goes outside of the RC process) - this was introduced in 5.8, so we'd need to backport 5.8, 5.9 & 6.0.

#4 @TimothyBlynJacobs
2 years ago

I'm not sure what that process would be like either. Cc: @SergeyBiryukov, @desrosj.

#5 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 6.0.1

I think changing a WP.org API response format does not happen often, so there might not be an established process :) For any major changes, I guess we'd generally bump the version in the http://api.wordpress.org/patterns/1.0/ URL from 1.0 to 1.1, so that older installs could continue to use the previous version.

If I understand correctly, that is not the case here, as the change is minor and we'd like to update the 5.8 and later branches to recognize the new keywords format in the patterns endpoint.

I have no objections to backporting this to 6.0 and then 5.9 and 5.8 as mentioned. For the latter two this will be included when there's a new security release for them.

#6 @costdev
2 years ago

  • Keywords needs-testing has-testing-info added

Adding testing keywords so PR 2935 can be picked up by the Test team.

#7 @SergeyBiryukov
2 years ago

In 53665:

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.

#8 @SergeyBiryukov
2 years ago

In 53666:

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.
Merges [53665] to the 6.0 branch.
See #56126.

#9 @SergeyBiryukov
2 years ago

Keeping the ticket open for now to also backport to 5.9 and 5.8 branches, per comment:3.

#10 @SergeyBiryukov
2 years ago

  • Keywords fixed-major added

This ticket was mentioned in Slack in #core by sergey. View the logs.


2 years ago

#12 @ugyensupport
2 years ago

Looks good on my end.

#13 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#14 @SergeyBiryukov
2 years ago

In 53674:

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.9 branch.
See #56126.

#15 @SergeyBiryukov
2 years ago

In 53675:

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.

#16 @SergeyBiryukov
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.