Canonical in category returns null
acalexuy opened this issue · 2 comments
Yoast version 17.0
Sample Query
query MyQuery { categories { nodes { seo { canonical } } } }
Sample response
{ "data": { "categories": { "nodes": [ { "seo": { "canonical": null } }, { "seo": { "canonical": null } }, { "seo": { "canonical": null } }, { "seo": { "canonical": null } }, { "seo": { "canonical": null } }, { "seo": { "canonical": null } }, { "seo": { "canonical": null } }, { "seo": { "canonical": null } }, { "seo": { "canonical": null } }, { "seo": { "canonical": null } } ] } }, "extensions": { "debug": [ { "type": "DEBUG_LOGS_INACTIVE", "message": "GraphQL Debug logging is not active. To see debug logs, GRAPHQL_DEBUG must be enabled." } ] } }
I've tried fixing it using this code, but not 100% sure if this is the best way to fix it.
Line 1211:
'canonical' => wp_gql_seo_format_string( YoastSEO()->meta->for_term($term->term_id) ->canonical ),
@acalexuy thanks for spotting this... this should be the correct way to fix it... i Will get this patched up and tested
Fixed in v4.15.1