Skip to content

Delete package

DELETE
/wp-json/wp2lms-pro/embed-packages/v1/packages/{id}
curl --request DELETE \
--url 'https://example.com/wp-json/wp2lms-pro/embed-packages/v1/packages/42?blog_id=1' \
--header 'X-WP-Nonce: <X-WP-Nonce>'

Permanently deletes the CPT post (wp_delete_post($id, true), not trash). The before_delete_post hook removes files under uploads/wp2lms-embed-packages/{id}/. This does not clear the page binding: _wp2_embed_replace_* post meta on WordPress pages may still point at the deleted package — clear it separately with DELETE …/pages/{page_id}/package. Not a package — 404 embed_packages_not_found. wp_delete_post returned false — 500 embed_packages_delete_failed. Requires manage_network (multisite) or edit_pages. Cookie + X-WP-Nonce or Application Password.

id
required
integer
>= 1

CPT wp2lms_embed_pkg post ID (the id field in the payload). Not blog_id and not page_id. Unknown id or another post_type — 404 embed_packages_not_found.

Example
42
blog_id
integer
>= 1

Network site ID (switch_to_blog). Optional: defaults to the request current blog. Not a package id and not page_id. Minimum 1; on a single site it must match the current site — otherwise 400 embed_packages_invalid_blog. In a network an unknown site or a site from another network is 404 embed_packages_unknown_blog.

Example
1

Package deleted. Body is { deleted: true, id }.

Media typeapplication/json
object
deleted

Always true on HTTP 200 — the CPT post was permanently deleted.

boolean
id

ID of the deleted package (the same {id} from the path).

integer
Example
{
"deleted": true,
"id": 42
}

Embed_packages_invalid_blog — blog_id < 1, or on a single site it does not match the current site.

Media typeapplication/json
object
code

WP_Error code (get_error_code()), e.g. embed_packages_not_found.

string
message

WP_Error text (get_error_message()).

string
data

WP_Error data. Usually { "status": 404 }. Ingest/materialize errors without status are returned by WordPress REST as 500.

object
Example
{
"code": "embed_packages_not_found",
"message": "Package not found.",
"data": {
"status": 404
}
}

Not authenticated. WordPress REST: rest_forbidden (status 401) when there is no cookie session. Cookie + X-WP-Nonce or Application Password.

Media typeapplication/json
object
code

WP_Error code (get_error_code()), e.g. embed_packages_not_found.

string
message

WP_Error text (get_error_message()).

string
data

WP_Error data. Usually { "status": 404 }. Ingest/materialize errors without status are returned by WordPress REST as 500.

object
Example
{
"code": "embed_packages_not_found",
"message": "Package not found.",
"data": {
"status": 404
}
}

Missing manage_network (multisite) or edit_pages (single site), or invalid REST nonce (rest_cookie_invalid_nonce).

Media typeapplication/json
object
code

WP_Error code (get_error_code()), e.g. embed_packages_not_found.

string
message

WP_Error text (get_error_message()).

string
data

WP_Error data. Usually { "status": 404 }. Ingest/materialize errors without status are returned by WordPress REST as 500.

object
Example
{
"code": "embed_packages_not_found",
"message": "Package not found.",
"data": {
"status": 404
}
}

Embed_packages_not_found — no package with this id; embed_packages_unknown_blog — unknown blog_id in the network.

Media typeapplication/json
object
code

WP_Error code (get_error_code()), e.g. embed_packages_not_found.

string
message

WP_Error text (get_error_message()).

string
data

WP_Error data. Usually { "status": 404 }. Ingest/materialize errors without status are returned by WordPress REST as 500.

object
Example
{
"code": "embed_packages_not_found",
"message": "Package not found.",
"data": {
"status": 404
}
}

Embed_packages_delete_failed — wp_delete_post returned false.

Media typeapplication/json
object
code

WP_Error code (get_error_code()), e.g. embed_packages_not_found.

string
message

WP_Error text (get_error_message()).

string
data

WP_Error data. Usually { "status": 404 }. Ingest/materialize errors without status are returned by WordPress REST as 500.

object
Example
{
"code": "embed_packages_not_found",
"message": "Package not found.",
"data": {
"status": 404
}
}