WP Manifestindependent plugin directory
manifest / seo / rank-math-seo-api

Rank Math SEO API

WordPress plugin exposing authenticated REST endpoints to update Rank Math SEO meta (title, description, focus keyword, canonical) on posts and terms — single or bulk.

★ 0stars

Install

Download source zip No release zip yet

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.zip
No 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/meta
  • POST /wp-json/rank-math-seo-api/v1/meta/bulk-get
  • POST /wp-json/rank-math-seo-api/v1/meta
  • POST /wp-json/rank-math-seo-api/v1/meta/bulk

Supported Meta Keys

Write endpoints accept:

  • rank_math_title
  • rank_math_description
  • rank_math_focus_keyword
  • rank_math_canonical_url

Read endpoints return stored values for:

  • rank_math_title
  • rank_math_description
  • rank_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.