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.


Parameters Parameters

$item

(array) (Required)

$fields

(array) (Required)


Top ↑

Return Return

(array)


Top ↑

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;
	}

Top ↑

User Contributed Notes User Contributed Notes

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