Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/dienmaythienxuan/rank-math-seo-api/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
Companion WordPress plugin that adds authenticated REST endpoints for reading and updating Rank Math SEO meta on posts and terms.
Endpoints
GET /wp-json/rank-math-seo-api/v1/metaPOST /wp-json/rank-math-seo-api/v1/meta/bulk-getPOST /wp-json/rank-math-seo-api/v1/metaPOST /wp-json/rank-math-seo-api/v1/meta/bulk
Supported Meta Keys
Write endpoints accept:
rank_math_titlerank_math_descriptionrank_math_focus_keywordrank_math_canonical_url
Read endpoints return stored values for:
rank_math_titlerank_math_descriptionrank_math_focus_keyword
Missing keys are returned as empty strings. Canonical URL is not included in read responses.
Single Read Example
curl -X GET "https://example.com/wp-json/rank-math-seo-api/v1/meta?object_type=post&object_id=123" \
-u "username:application-password"
Response:
{
"rank_math_title": "SEO title",
"rank_math_description": "SEO description",
"rank_math_focus_keyword": "keyword 1, keyword 2"
}
Bulk Read Example
curl -X POST "https://example.com/wp-json/rank-math-seo-api/v1/meta/bulk-get" \
-u "username:application-password" \
-H "Content-Type: application/json" \
-d '{
"items": [
{ "object_type": "post", "object_id": 123 },
{ "object_type": "term", "object_id": 45 }
]
}'
Successful items include object_type and object_id so each result can be matched, plus the three stored SEO keys.
Single Update Example
curl -X POST "https://example.com/wp-json/rank-math-seo-api/v1/meta" \
-u "username:application-password" \
-H "Content-Type: application/json" \
-d '{
"object_type": "post",
"object_id": 123,
"meta": {
"rank_math_title": "SEO title",
"rank_math_description": "SEO description",
"rank_math_focus_keyword": "keyword 1, keyword 2",
"rank_math_canonical_url": "https://example.com/page"
}
}'
Bulk Update Example
curl -X POST "https://example.com/wp-json/rank-math-seo-api/v1/meta/bulk" \
-u "username:application-password" \
-H "Content-Type: application/json" \
-d '{
"items": [
{
"object_type": "post",
"object_id": 123,
"meta": {
"rank_math_title": "SEO title"
}
},
{
"object_type": "term",
"object_id": 45,
"meta": {
"rank_math_focus_keyword": "category keyword"
}
}
]
}'
object_type must be post or term. Omitted meta keys are unchanged. Empty strings are allowed and clear the stored value.