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.

by Neil · github.com/dienmaythienxuan/rank-math-seo-api · website

1stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/dienmaythienxuan/rank-math-seo-api/archive/refs/heads/main.zip

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.