HELP - Update Post Yoast SEO data from Mysql

Hey guys! Can someone help me: I need to identify this data generated by the post in the Mysql frame to update the Yoast seo of the post.

What code do I put there in the Mysql node to pull this data?


UPDATE wp_postmeta
SET meta_value =
CASE
WHEN meta_key = ‘yoast_wpseo_focuskw_text_input’ THEN ‘NAME
WHEN meta_key = ‘yoast_wpseo_title’ THEN ‘NAME
WHEN meta_key = ‘yoast_wpseo_metadesc’ THEN ‘NAME
END
WHERE meta_key IN (‘yoast_wpseo_focuskw_text_input’, ‘yoast_wpseo_title’, ‘yoast_wpseo_metadesc’)
AND post_id = {{$node[“Wordpress”].json[“id”]}}

Do you want to use the yoast_head_json.og_title field from your incoming item in your MySQL query instead of 'NAME'?

Simply replace NAME with an expression like {{ $json.yoast_head_json.og_title }} reading data from exactly this field.

How to use expressions isn’t super specific to Wordpress or Mysql though, instead it’s a rather fundamental concept when using n8n. Perhaps you want to give the basic n8n course over at Courses | n8n Docs a go? This was originally written for older versions of n8n, but I think working through this is still a solid foundation for working even with current versions of n8n.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.