# How to Automate WordPress SEO Reports using the API

- Tool: API Automations
- Difficulty: Intermediate
- Fix time: 60 minutes
- Compatibility: WordPress 5.6+, Yoast SEO or RankMath required for SEO metadata
- Last updated: May 2026

## TL;DR

Fetch all published posts with GET /wp/v2/posts?status=publish&per_page=100, paginating via X-WP-TotalPages. Yoast SEO exposes a yoast_head_json object in each post response containing title, meta_desc, robots, and schema data. RankMath exposes similar fields. Flag posts with missing meta descriptions, titles over 60 characters, and pages without featured images. SEO meta fields are plugin-dependent — if neither Yoast nor RankMath is installed, the REST response contains no SEO data.

## Best practices

- Request only the fields you need with _fields=id,title,link,date,featured_media,yoast_head_json — reduces response size by 80% and speeds up pagination
- Always check for the presence of yoast_head_json before accessing nested properties — Yoast may be installed but inactive on specific post types
- Add 500ms delays between page requests when auditing large sites to avoid triggering managed host throttles
- Audit pages separately from posts — /wp/v2/pages uses the same SEO fields but is a separate endpoint
- Flag posts where meta_description length is < 50 chars as well as missing — very short descriptions are almost as bad as none
- Include the noindex audit — posts accidentally set to noindex are invisible to search engines and often go unnoticed for months
- Schedule weekly rather than daily — SEO metadata changes slowly and daily runs waste API quota without providing new signal

## Frequently asked questions

### Why doesn't yoast_head_json appear in my post API responses?

Yoast SEO must be installed and activated to register the yoast_head_json field. Check the Plugins page in WordPress admin. Also verify that the Yoast REST API endpoint is enabled — go to Yoast SEO → General → Features → REST API endpoint and ensure it's on.

### Can I get SEO data from posts without Yoast or RankMath?

WordPress core does not include SEO metadata fields in the REST API. Without Yoast SEO or RankMath, your audit will only have access to the post title (title.rendered) and raw content — not SEO-specific title tags, meta descriptions, or robots directives. Install one of these plugins to enable SEO field exposure.

### How do I audit SEO on WooCommerce product pages?

WooCommerce registers products as a custom post type. Access them via GET /wp/v2/product (if registered with show_in_rest: true). Yoast SEO extends to product pages and includes yoast_head_json in product responses. The same audit logic applies.

### Does this work for WordPress.com hosted sites?

WordPress.com uses its own REST API (developer.wordpress.com) which differs from self-hosted WordPress. The endpoint paths are different and the SEO plugin integration may not expose the same fields. This guide applies to self-hosted WordPress.org installations.

### Can I update SEO metadata via the REST API?

Yes. Yoast SEO allows updating yoast_head_json fields via PATCH /wp/v2/posts/{id} with the meta.yoast_wpseo_title and meta.yoast_wpseo_metadesc fields. This varies by Yoast version — check the Yoast REST API documentation for the exact meta key names used in your installed version.

### What's the best way to schedule this audit automatically?

For self-hosted scripts, use cron (Linux/Mac) or Task Scheduler (Windows) to run weekly. For cloud automation, AWS EventBridge Rules or GitHub Actions scheduled workflows are clean options. The script should take 30-120 seconds to run depending on post count — well within any scheduler timeout.

### How many API requests does auditing a 500-post site require?

At per_page=100, a 500-post site requires 5 requests for posts plus additional requests for pages. Total is typically 7-12 requests for a complete audit. This is well within any reasonable rate limit — even managed hosts with aggressive throttling will handle 12 requests without issue.

---

Source: https://www.rapidevelopers.com/api-automations/how-to-automate-wordpress-seo-reports-using-the-api
© RapidDev — https://www.rapidevelopers.com/api-automations/how-to-automate-wordpress-seo-reports-using-the-api
