Quick overview
This workflow runs daily to check recently published WordPress posts for missing or overlong SEO title and meta description tags, uses Google Gemini to draft compliant replacements, requests approval in Slack, and then updates the post via the WordPress REST API before posting a run summary to Slack.
How it works
- Runs every day on a schedule and fetches the most recent WordPress posts using the WordPress REST API.
- Filters the list to posts published within the configured time window and processes them one at a time.
- Loads each post’s live page, extracts SEO-related tags (title, meta description, robots, canonical, H1) and key text content, and flags issues such as noindex, missing/incorrect canonical, multiple H1s, or length problems.
- When the title or meta description is missing or exceeds the configured character limits, sends the post context to Google Gemini to draft a new title and meta description in a structured JSON format.
- Posts a Slack message showing the issues and the proposed before/after text with character counts, then waits up to one day for an approval decision.
- If approved, updates the WordPress post title and excerpt (used as the meta description) via the WordPress REST API and confirms the change in Slack; if not approved, records the post as skipped.
- Aggregates outcomes across all checked posts and posts a Slack summary listing what was updated, skipped, clean, or needs a manual check.
Setup
- Create a WordPress Application Password (or equivalent) and add an HTTP Basic Auth credential for the WordPress REST API update request.
- Add Google Gemini credentials (API key) for the Gemini chat model used to draft SEO text.
- Add Slack credentials for sending messages with approvals, then set the target channel IDs for the approval message, confirmation message, and summary message.
- Update the Config values, especially site_url and post_type (REST base), and adjust hours, title_max, and description_max to match your SEO requirements.
Requirements
- A WordPress site with the REST API enabled and an application password for a user who can edit posts
- A Google Gemini API key
- A Slack app with the chat:write scope, invited to the target channel
Customization
- title_max and description_max count characters; lower them for Japanese sites
- The description is saved as the post excerpt (Rank Math's default meta description). If your SEO plugin exposes its own field over REST, change the body of Update Post
- Edit the prompt in Draft Fixes to add brand rules
- Raise hours (for example to 168) to review a full week of posts