Issue with creating yoast meta description for Wordpress Blog

I have a workflow that uses Open AI to create a blog post and a featured image in Wordpress. Works well. Now I need to add a focus seo keyword and meta description, both generated in the workflow.

I can use the MySQL node to edit the meta description and / or the focus keyword for the post in the database. But for new posts those meta keys don’t yet exist. If I edit them in Wordpress post editor first, I can then update them with new values. That’s is obviously of little value as I want to create them via the n8n workflow

How can I create the meta keys

_yoast_wpseo_focuskw
_yoast_wpseo_metadesc

for a brand new post and then populate them with the data form the work flow.

I assume the answer would be a MySQL query?

Here is the portion of the workflow that successfully edits the meta keys if they are pre-existing

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I answered my own question

INSERT INTO wp_postmeta (post_id, meta_key, meta_value)
VALUES (your_post_id, '_yoast_wpseo_metadesc', 'your_meta_description');;

That creates the row and adds in meta description.

3 Likes

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