Block 1 - Settings
- Type / Role
- n8n-nodes-base.set - set
- Config choices
- Version 3.4
This workflow is provided as-is. Please review and test before using in production.
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 ...
n8n-nodes-base.set, n8n-nodes-base.manualtrigger, n8n-nodes-base.httprequest, n8n-nodes-base.stickynote
This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by phil.
Original n8n.io sourceThis 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.
Settings node, replace the value of the wordpress URL variable with the full URL of your WordPress site (e.g., https://your-domain.com/).HTTP Request - Update Yoast Meta node, select your pre-configured WordPress credentials from the Credential for WordPress API dropdown menu.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.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.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 }}.yoast_canonical_url) and add them to the Body Parameters section of the HTTP Request node.When clicking ‘Test workflow’ node with any other trigger node to fit your use case, such as:// 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.
.
🇫🇷 Contactez nous pour automatiser vos processus
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.
| 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 |
Use the JSON export at /data/workflows/7180/7180.json as the source template for this automation.
Open n8n, import the downloaded JSON, and review each node before activating the workflow.
Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.
Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.
Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.
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.
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 ...
Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.
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.