Yoast / YoastSEO.js

Analyze content on a page and give SEO feedback as well as render a snippet preview.
GNU General Public License v3.0
403 stars 171 forks source link

Quotes in related keyphrase causes unexpected token in JSON error #2158

Closed monbauza closed 5 years ago

monbauza commented 5 years ago

Description of the problem

In this post, we explain that Yoast SEO filters function words by default and that you can force an exact match result by adding your focus keyphrase in quotes, i.e. "The Who". This works fine with the (main) focus keyphrase, however, when the quotes are used in related keyphrases, the error below appears in the browser's console. After saving the post, the related keyphrases are no longer shown in the Yoast metabox.

image

Note: Once the problem occurs, the WordPress database needs to be edited to fix it (in particular, the _yoast_wpseo_focuskeywords field in the wp_postmeta table)

How can we reproduce this behavior?

  1. Install Yoast SEO Premium
  2. Create a new post
  3. Add a focus keyword and a related keyword that includes quotes (see screenshot below)
  4. Save the post and reload the page
  5. note that the aforementioned error appears in the browser's console and that it's no longer possible to add/edit related kephrases

image

Technical info

monbauza commented 5 years ago

Please inform the customer of conversation # 475729 when this conversation has been closed.

Djennez commented 5 years ago

Bug confirmed. Seems like the normal keyphrase gets saved as a single instance with which quotes do not break. The related keyphrases get saved in the database as json arrays and break on double quotes:

keyphrase