Skip to content

Replace capability and current file info

GET
/wp-json/wp2/enable-media-replace/v1/attachments/{id}/replace-info
curl --request GET \
--url https://example.com/wp-json/wp2/enable-media-replace/v1/attachments/1/replace-info \
--header 'X-WP-Nonce: <X-WP-Nonce>'

Reports whether the attachment file can be replaced while keeping the same ID: current name, MIME, replace modes. can_replace is false when playback artifacts are already linked. Returns 403 if the standalone Enable Media Replace plugin is active.

id
required
integer

Numeric entity id.

Media typeapplication/json
object
attachment_id

Media library attachment ID.

integer
filename

Field “filename” as returned or accepted by PHP.

string
url

URL.

string
mime_type

Field “mime_type” as returned or accepted by PHP.

string
can_replace

Field “can_replace” as returned or accepted by PHP.

boolean
blocked_by_playback_artifacts

Field “blocked_by_playback_artifacts” as returned or accepted by PHP.

boolean
block_reason

Field “block_reason” as returned or accepted by PHP.

string
playback_artifacts

Field “playback_artifacts” as returned or accepted by PHP.

Array<object>
object
key

Password-reset key from email, or a queue key.

string
label

Product label.

string
count

Count.

integer
modes

Field “modes” as returned or accepted by PHP.

Array<string>
time_modes

Field “time_modes” as returned or accepted by PHP.

Array<string>
Examplegenerated
{
"attachment_id": 1,
"filename": "example",
"url": "example",
"mime_type": "example",
"can_replace": true,
"blocked_by_playback_artifacts": true,
"block_reason": "example",
"playback_artifacts": [
{
"key": "example",
"label": "example",
"count": 1
}
],
"modes": [
"example"
],
"time_modes": [
"example"
]
}

Not authenticated. WordPress REST: rest_not_logged_in / rest_forbidden. Use cookie + X-WP-Nonce or Application Password.

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}

Insufficient capability or invalid REST nonce. WordPress REST: rest_forbidden / rest_cookie_invalid_nonce.

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}