ashhitch / wp-graphql-yoast-seo

This is an extension to the WPGraphQL plugin for Yoast SEO
GNU General Public License v3.0
225 stars 48 forks source link

Wrong returned term SEO title. #153

Open akkis opened 1 year ago

akkis commented 1 year ago

I have some terms in 3 levels like:

  1. By Experience (first level)
  2. By Experience -> Adventure (second level)
  3. By Experience -> Adventure -> By Sea (third level)

However, by running graphql query, seo node of every term (of every parent-child level) returns opengraphTitle with the value of "Adventure Archives < siteTitle etc >". It seems that choose only the "Adventure" term.

Also, if I change the SEO title manually of any term (from WP term edit page), then the query returns this error:

{
  "errors": {
    "message": "Unexpected token '<', \"<div id=\"e\"... is not valid JSON",
    "stack": "SyntaxError: Unexpected token '<', \"<div id=\"e\"... is not valid JSON"
  }
}

The full error message start with <div id="error"><p class="wpdberror"><strong>WordPress database error:</strong> [Column &#039;ancestor_id&#039; cannot be null]<br /><code>INSERT INTO 'wp_yoast_indexable_hierarchy' ('indexable_id', 'ancestor_id', 'depth', 'blog_id') VALUES (&#039;1&#039;, NULL, &#039;1&#039;, &#039;1&#039;)</code></p></div>{"data": ... and that's why it is not a valid JSON, as error message says.

To restore query success, you need to do these steps.

Please, note that I am on dev environment with WPML activated.