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_non_post_type( string $id )
Delete non-post type elements
Description Description
Currently handles deletion of question choices. In the future additional non-post type elements may be handled by this method.
Parameters Parameters
- $id
-
(string) (Required) Custom item ID. This should be a question choice id in the format of "${question_id}:{$choice_id}".
Return Return
(null|true|WP_Error) null
when the $id cannot be parsed into a question choice id. true
on success. WP_Error
when an error is encountered.
Source Source
File: includes/admin/class.llms.admin.builder.php
private static function process_trash_item_non_post_type( $id ) { // Can't process. if ( false === strpos( $id, ':' ) ) { return null; } $split = explode( ':', $id ); $question = llms_get_post( $split[0] ); // Not a question choice. if ( ! $question || ! is_a( $question, 'LLMS_Question' ) ) { return null; } // Error. if ( ! $question->delete_choice( $split[1] ) ) { // Translators: %s = Question choice ID. return new WP_Error( 'llms_builder_trash_custom_item', sprintf( esc_html__( 'Error deleting the question choice "%s"', 'lifterlms' ), $id ) ); } // Success. return true; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.37.12 | Introduced. |