Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Admin_Builder::process_trash_item( mixed $id )

Trash (or delete) a single item

Parameters Parameters


(mixed) (Required) Item id. Usually a WP_Post ID but can also be custom ID strings.

Top ↑

Return Return

(array) Associative array containing information about the trashed item. On success returns an array with an id key corresponding to the item's id. On failure returns the id as well as an error key which is a string describing the error.

Top ↑

Source Source

File: includes/admin/class.llms.admin.builder.php

	private static function process_trash_item( $id ) {

		// Default response.
		$res = array(
			// Translators: %s = Item id.
			'error' => sprintf( esc_html__( 'Unable to delete "%s". Invalid ID.', 'lifterlms' ), $id ),
			'id'    => $id,

		 * Custom or 3rd party items can perform custom deletion actions using this filter.
		 * Return an associative array containing at least the `$id` to cease execution and have
		 * the custom item returned via the `process_trash()` method.
		 * A successful deletion return should be: `array( 'id' => $id )`.
		 * A failure should contain an error message in a second array member:
		 * `array( 'id' => $id, 'error' => esc_html__( 'My error message', 'my-domain' ) )`.
		 * @since Unknown.
		 * @param null|array $trash_response Denotes the trash response. See description above for details.
		 * @param array      $res            The initial default error response which can be modified for your needs and then returned.
		 * @param mixed      $id             The ID of the course element. Usually a WP_Post id.
		$custom = apply_filters( 'llms_builder_trash_custom_item', null, $res, $id );
		if ( $custom ) {
			return $custom;

		// Determine the element's post type.
		$type = is_numeric( $id ) ? get_post_type( $id ) : false;

		if ( $type ) {
			$status = self::process_trash_item_post_type( $id, $type );
		} else {
			$status = self::process_trash_item_non_post_type( $id );

		// Error deleting.
		if ( is_wp_error( $status ) ) {
			$res['error'] = $status->get_error_message();

		} elseif ( true === $status ) {
			// Success.
			unset( $res['error'] );


		return $res;


Top ↑

Changelog Changelog

Version Description
3.37.12 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.