Skip to main content

Automate SEO title & description updates for WordPress with Yoast SEO API

Workflow preview

Workflow preview
100%
Automate SEO title & description updates for WordPress with Yoast SEO API preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This workflow automates the update of Yoast SEO metadata for a specific post or product on a WordPress or WooCommerce site. It sends a request to a custom API endpoint exposed by the Yoast SEO API ...

Best for

  • Content Creation automation workflows
  • beginner n8n builders looking for reusable templates

Tools used

n8n-nodes-base.set, n8n-nodes-base.manualtrigger, n8n-nodes-base.httprequest, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by phil.

Original n8n.io source

1.1 Workflow description

Title
Automate SEO title & description updates for WordPress with Yoast SEO API
Workflow name
Automate SEO title & description updates for WordPress with Yoast SEO API

This workflow automates the update of Yoast SEO metadata for a specific post or product on a WordPress or WooCommerce site.

It sends a POST request to a custom API endpoint exposed by the Yoast SEO API Manager plugin, allowing for programmatic changes to the SEO title and meta description.

Bulk version available here.

Prerequisites

  • A WordPress site with administrator access.
  • The Yoast SEO plugin installed and activated.
  • The Yoast SEO API Manager companion plugin installed and activated to expose the required API endpoint.
  • WordPress credentials configured within your n8n instance.

Setup Steps

  1. Configure the Settings Node: In the Settings node, replace the value of the wordpress URL variable with the full URL of your WordPress site (e.g., https://your-domain.com/).
  2. Set Credentials: In the HTTP Request - Update Yoast Meta node, select your pre-configured WordPress credentials from the Credential for WordPress API dropdown menu.
  3. Define Target and Content: In the same HTTP Request node, navigate to the Body Parameters section and update the following values:
    • post_id: The ID of the WordPress post or WooCommerce product you wish to update.
    • yoast_title: The new SEO title.
    • yoast_description: The new meta description.

How It Works

  1. Manual Trigger: The workflow is initiated manually. This can be replaced by any trigger node for full automation.
  2. Settings Node: This node defines the base URL of the target WordPress instance. This centralizes the configuration, making it easier to manage.
  3. HTTP Request Node: This is the core component. It constructs and sends a POST request to the /wp-json/yoast-api/v1/update-meta endpoint. The request body contains the post_id and the new metadata, and it authenticates using the selected n8n WordPress credentials.

Customization Guide

  • Dynamic Inputs: To update posts dynamically, replace the static values in the HTTP Request node with n8n expressions. For example, you can use data from a Google Sheets node by setting the post_id value to an expression like {{ $json.column_name }}.
  • Update Additional Fields: The underlying API may support updating other Yoast fields. Consult the Yoast SEO API Manager plugin's documentation to identify other available parameters (e.g., yoast_canonical_url) and add them to the Body Parameters section of the HTTP Request node.
  • Change the Trigger: Replace the When clicking ‘Test workflow’ node with any other trigger node to fit your use case, such as:
    • Schedule: To run the update on a recurring basis.
    • Webhook: To trigger the update from an external service.
    • Google Sheets: To trigger the workflow whenever a row is added or updated in a specific sheet.

Yoast SEO API Manager Plugin for WordPress

// ATTENTION: Replace the line below with <?php - This is necessary due to display constraints in web interfaces.

<?php
/**
 * Plugin Name: Yoast SEO API Manager v1.2
 * Description: Manages the update of Yoast metadata (SEO Title, Meta Description) via a dedicated REST API endpoint.
 * Version: 1.2
 * Author: Phil - https://inforeole.fr (Adapted by Expert n8n)
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

class Yoast_API_Manager {

    public function __construct() {
        add_action('rest_api_init', [$this, 'register_api_routes']);
    }

    /**
     * Registers the REST API route to update Yoast meta fields.
     */
    public function register_api_routes() {
        register_rest_route( 'yoast-api/v1', '/update-meta', [
            'methods'             => 'POST',
            'callback'            => [$this, 'update_yoast_meta'],
            'permission_callback' => [$this, 'check_route_permission'],
            'args'                => [
                'post_id' => [
                    'required'          => true,
                    'validate_callback' => function( $param ) {
                        $post = get_post( (int) $param );
                        if ( ! $post ) {
                            return false;
                        }
                        $allowed_post_types = class_exists('WooCommerce') ? ['post', 'product'] : ['post'];
                        return in_array($post->post_type, $allowed_post_types, true);
                    },
                    'sanitize_callback' => 'absint',
                ],
                'yoast_title' => [
                    'type'              => 'string',
                    'sanitize_callback' => 'sanitize_text_field',
                ],
                'yoast_description' => [
                    'type'              => 'string',
                    'sanitize_callback' => 'sanitize_text_field',
                ],
            ],
        ] );
    }

    /**
     * Updates the Yoast meta fields for a specific post.
     *
     * @param WP_REST_Request $request The REST API request instance.
     * @return WP_REST_Response|WP_Error Response object on success, or WP_Error on failure.
     */
    public function update_yoast_meta( WP_REST_Request $request ) {
        $post_id = $request->get_param('post_id');

        if ( ! current_user_can('edit_post', $post_id) ) {
            return new WP_Error(
                'rest_forbidden',
                'You do not have permission to edit this post.',
                ['status' => 403]
            );
        }

        // Map API parameters to Yoast database meta keys
        $fields_map = [
            'yoast_title'       => '_yoast_wpseo_title',
            'yoast_description' => '_yoast_wpseo_metadesc',
        ];

        $results = [];
        $updated = false;

        foreach ( $fields_map as $param_name => $meta_key ) {
            if ( $request->has_param( $param_name ) ) {
                $value = $request->get_param( $param_name );
                update_post_meta( $post_id, $meta_key, $value );
                $results[$param_name] = 'updated';
                $updated = true;
            }
        }

        if ( ! $updated ) {
            return new WP_Error(
                'no_fields_provided',
                'No Yoast fields were provided for update.',
                ['status' => 400]
            );
        }

        return new WP_REST_Response( $results, 200 );
    }

    /**
     * Checks if the current user has permission to access the REST API route.
     *
     * @return bool
     */
    public function check_route_permission() {
        return current_user_can( 'edit_posts' );
    }
}

new Yoast_API_Manager();

Bulk version available here : this bulk version, provided with a dedicated WordPress plugin, allows you to generate and bulk-update meta titles and descriptions for multiple articles simultaneously using artificial intelligence. It automates the entire process, from article selection to the final update in Yoast, offering considerable time savings.

.


Phil | Inforeole | Linkedin

🇫🇷 Contactez nous pour automatiser vos processus

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Settings

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 2 - When clicking ‘Test workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 3 - HTTP Request - Update Yoast Meta

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 4 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Automate SEO title & description updates for WordPress with Yoast SEO API
Complexity beginner
Nodes 4
Categories Content Creation
Author phil
Published 08 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7180/7180.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automate SEO title & description updates for WordPress with Yoast SEO API do?

This workflow automates the update of Yoast SEO metadata for a specific post or product on a WordPress or WooCommerce site. It sends a request to a custom API endpoint exposed by the Yoast SEO API ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Content Creation use case.