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.
Command::limit_item_to_fields( array $item, array $fields )
Reduce an item to specific fields.
Contents
Parameters Parameters
- $item
-
(array) (Required)
- $fields
-
(array) (Required)
Return Return
(array)
Source Source
File: libraries/lifterlms-cli/src/Commands/Restful/Command.php
private static function limit_item_to_fields( $item, $fields ) { if ( empty( $fields ) ) { return $item; } if ( is_string( $fields ) ) { $fields = explode( ',', $fields ); } foreach ( $item as $i => $field ) { if ( ! in_array( $i, $fields ) ) { unset( $item[ $i ] ); } } return $item; }
Expand full source code Collapse full source code View on GitHub