REST APIeasy-svg-pro/v1/replace

easy-svg-pro/v1/replace

Swaps one icon for another in every post and post meta value, and reports each place.

REST endpoint · Easy SVG Pro · Status: Internal · Defined in includes/replace/replace.php

Internal: not part of the promised public surface. It may change without notice.

Usage

POST /wp-json/easy-svg-pro/v1/replace

Example

curl -X POST "https://example.com/wp-json/easy-svg-pro/v1/replace" \
	-H "X-WP-Nonce: $NONCE" -b "$COOKIES" \
	-H "Content-Type: application/json" \
	-d '{"from": "acme/arrow", "to": "acme/arrow-right"}'

Description

The target must be an icon this site has, otherwise 422 easy_svg_pro_unknown_icon and nothing changes, because a missing icon renders as nothing. Content is rewritten with WordPress's own post update and meta with its meta update. The same bound of 500 places applies as in the preview.

Permission: manage_options and an active licence with the Replace everywhere feature switched on under Icons, Features.

Parameters

body
fromstring
Required

The icon being replaced, as collection/slug.

body
tostring
Required

The icon to use instead. It has to be an icon this site has.

Return value

returnobject

{from, to, report: [{id, where, state, count}]} with state replaced, nothing, gone or failed. 400 easy_svg_pro_no_icon or easy_svg_pro_same_icon for bad input.

Response

{from, to, report: [{id, where, state, count}]} with state replaced, nothing, gone or failed. 400 easy_svg_pro_no_icon or easy_svg_pro_same_icon for bad input.

{
  "from": "acme/arrow",
  "to": "acme/arrow-right",
  "report": [
    {
      "id": 12,
      "where": "content",
      "state": "replaced",
      "count": 2
    }
  ]
}
This rewrites other people's posts and post meta directly; take a backup and run the preview first.