WordPress / pattern-directory

The WordPress Block Pattern Directory
https://wordpress.org/patterns/
GNU General Public License v2.0
125 stars 35 forks source link

Add results check for URL field #682

Closed pkevan closed 6 months ago

pkevan commented 6 months ago

get_term_link can return WP_Error if there is no matching term (https://developer.wordpress.org/reference/functions/get_term_link/) - this additional check protects against this and the warnings produced from attempting to escape this.

if we want to produce a standard URL i.e. home_url this could also be possible, although unsure what the implications are for doing so i.e. indexing the URLs etc

ryelle commented 6 months ago

I think this will always be a "no results" page, so I would rather not output any meta tags — I think @dd32's solution in #681 would be better (checking before we're in the conditional), what do you think of that PR?

pkevan commented 6 months ago

what do you think of that PR?

I should have checked for existing PRs first 😄

@dd32's solution is neater, just not sure on the implication of having them not there - I'd guess it's probably fine, but that was my concern.

ryelle commented 6 months ago

Thanks, I've merged #681, so I'll close this one.