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
- $id
-
(mixed) (Required) Item id. Usually a WP_Post ID but can also be custom ID strings.
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.
Source Source
File: includes/admin/class.llms.admin.builder.php
$ret = array(); foreach ( $data['trash'] as $id ) { $ret[] = self::process_trash_item( $id ); } return $ret; } /** * Trash (or delete) a single item * * @since 3.37.12 * * @param mixed $id Item id. Usually a WP_Post ID but can also be custom ID strings. * @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. */ 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;
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.37.12 | Introduced. |