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.

Main::get_available_addons( string $status, bool $check_license, string $type = 'all' )

Retrieve an array of available add-on slugs based on the supplied query criteria.

Description Description

This function passes data to wp llms addon list with specific filters and returns an associative array of add-on slugs from that list.

This is used, mostly, to generate a list of available addons for various commands which provide an --all flag/option.

Top ↑

Parameters Parameters


(string) (Required) Add-on status, passed as the --status option to llms addon list.


(bool) (Required) Whether or not the add-on should be licensed. This is used to determine what is installable / upgradeable.


(string) (Optional) Add-on type. Accepts 'all' (default), 'plugin' or 'theme'.

Default value: 'all'

Top ↑

Return Return

(string[]) Array of add-on slugs meeting the specified filters.

Top ↑

Source Source

File: libraries/lifterlms-cli/src/Commands/AddOn/Main.php

	private function get_available_addons( $status, $check_license, $type = 'all' ) {

		$list = \WP_CLI::runcommand(
			"llms addon list --format=json --status={$status} --fields=name,license,type",
				'return' => true,
		$list = array_filter(
			json_decode( $list, true ),
			function( $item ) use ( $check_license, $type ) {
				return ( ( $check_license && 'active' === $item['license'] ) || ! $check_license ) && ( 'all' === $type || $type === $item['type'] );

		return wp_list_pluck( $list, 'name' );


Top ↑

Changelog Changelog

Version Description
0.0.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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