Skip to main content

GET /images/settings

Returns all image optimization settings and server capability flags.
curl -X GET https://example.com/wp-json/wp-manager-pro/v1/images/settings \
  -H "X-WP-Nonce: YOUR_NONCE"

Response

webp_enabled
boolean
Whether WebP conversion on upload is enabled.
max_width
integer
Maximum image width in pixels. 0 means no limit.
max_height
integer
Maximum image height in pixels. 0 means no limit.
jpeg_quality
integer
JPEG compression quality (0–100). Default is 82.
thumbnail_sizes
object
Map of registered image size keys to their width, height, crop, and name.
gd_support
boolean
Whether the GD image library is available on the server.
imagick_support
boolean
Whether the Imagick extension is available on the server.
webp_support
boolean
Whether WebP encoding is supported by the active image editor.
avif_enabled
boolean
Whether AVIF conversion on upload is enabled.
avif_support
boolean
Whether AVIF encoding is supported by the active image editor.
svg_enabled
boolean
Whether SVG uploads are allowed.
svg_allowed_roles
array
List of role slugs permitted to upload SVG files.
webp_serve_webp
boolean
Whether WebP sidecars are transparently served to supporting browsers.
webp_delete_originals
boolean
Whether original files are deleted when replaced by WebP on upload.

POST /images/settings

Saves image optimization settings. When webp_serve_webp is enabled, .htaccess rewrite rules are written to the uploads directory so the web server transparently serves .webp sidecar files.
curl -X POST https://example.com/wp-json/wp-manager-pro/v1/images/settings \
  -H "X-WP-Nonce: YOUR_NONCE" \
  -H "Content-Type: application/json" \
  -d '{"webp_enabled": true, "jpeg_quality": 80, "max_width": 2000}'

Parameters

webp_enabled
boolean
Enable automatic WebP conversion on image upload.
max_width
integer
Maximum image width in pixels. Use 0 for no limit.
max_height
integer
Maximum image height in pixels. Use 0 for no limit.
jpeg_quality
integer
JPEG compression quality from 0 to 100. Defaults to 82.
avif_enabled
boolean
Enable automatic AVIF sidecar generation on upload.
svg_enabled
boolean
Allow SVG file uploads.
svg_allowed_roles
array
Role slugs that can upload SVGs. Defaults to ["administrator"].
webp_serve_webp
boolean
Transparently serve .webp sidecar files to browsers that accept WebP. Writes .htaccess rules to the uploads directory.
webp_delete_originals
boolean
Delete the original file and replace it with the WebP version on upload.

Response

success
boolean
Always true on success.
message
string
Confirmation message.

POST /images/regenerate

Regenerates thumbnail sizes for all image attachments in the media library. This is useful after changing image size settings.
curl -X POST https://example.com/wp-json/wp-manager-pro/v1/images/regenerate \
  -H "X-WP-Nonce: YOUR_NONCE"

Response

success
boolean
Always true on success.
processed
integer
Number of images successfully processed.
errors
integer
Number of images that could not be processed (missing files or editor errors).
message
string
Summary message.

POST /images/convert

Available since v1.5.0
Batch converts existing media library images to WebP or AVIF. Processes a batch of images per call; loop using next_offset until has_more is false.
curl -X POST https://example.com/wp-json/wp-manager-pro/v1/images/convert \
  -H "X-WP-Nonce: YOUR_NONCE" \
  -H "Content-Type: application/json" \
  -d '{"format": "webp", "offset": 0, "limit": 10}'

Parameters

format
string
required
Target format. Must be webp or avif.
offset
integer
Number of images to skip. Used for pagination. Defaults to 0.
limit
integer
Images to process per call. Maximum is 50. Defaults to 10.
delete_original
boolean
Delete the original file and update the attachment record to point to the converted file. Only supported for webp format.

Response

success
boolean
Always true.
converted
integer
Number of images converted in this batch.
skipped
integer
Number of images skipped because the converted version already existed.
errors
integer
Number of images that failed to convert.
has_more
boolean
true if there are more images to process.
next_offset
integer
Offset to use in the next request when has_more is true.

GET /images/convert-stats

Available since v1.5.0
Returns conversion statistics for the media library — how many images exist and how many already have a converted sidecar.
curl -X GET "https://example.com/wp-json/wp-manager-pro/v1/images/convert-stats?format=webp" \
  -H "X-WP-Nonce: YOUR_NONCE"

Parameters

format
string
Format to check stats for. webp or avif. Defaults to webp.

Response

total
integer
Total number of convertible images (JPEG, PNG, GIF, BMP, TIFF) in the media library.
converted
integer
Number of images that already have a converted sidecar file on disk.
remaining
integer
Number of images that have not yet been converted.

DELETE /images/convert

Available since v1.6.0
Deletes all sidecar files of the specified format from the media library. The original attachments are not affected.
This permanently deletes all .webp or .avif sidecar files from disk. The operation cannot be undone.
curl -X DELETE https://example.com/wp-json/wp-manager-pro/v1/images/convert \
  -H "X-WP-Nonce: YOUR_NONCE" \
  -H "Content-Type: application/json" \
  -d '{"format": "webp"}'

Parameters

format
string
required
Format of sidecar files to delete. Must be webp or avif.

Response

success
boolean
Always true.
deleted
integer
Number of sidecar files deleted.
message
string
Summary message.

Build docs developers (and LLMs) love