Version Repository – retrieve

Please note: Functionality described on this page requires Download Monitor version 4.0 or above.

Versions in Download Monitor can be fetched via the Version Repository. Retrieve is a method of Download Monitor’s version repository service. The method returns an array of versions. Modifiable with filters. Can be limited and offset.

Signature

public function retrieve( $filters=array(), $limit=0, $offset=0 ) {}

Parameters

ParameterTypeDefaultDescription
$filtersarrayarray()The filters that set what versions will be fetch. Basic WP_Query parameters can be used here with some exceptions. Ignored parameters are post_type, posts_per_page, offset, paged, nopaging.
$limitint0Allows you to limit the amount of versions that are fetched.
$offsetint0The offset specifies the offset of the first row to return. Allows you to skip given offset of versions in the result set.

Examples

Retrieve all versions of Download ID 9

This snippet retrieves all versions for download with ID 11.

$versions = download_monitor()->service( 'version_repository' )->retrieve(
array(
'post_parent' => 11
));
Retrieve all downloads, order by title

This snippet retrieves the latest version for download with ID 11.

$versions = download_monitor()->service( 'version_repository' )->retrieve(
array(
'post_parent' => 11
));

Retrieving a single version can also be done with retrieve_single method.

Was this article helpful?
Start Protecting your WordPress Downloads

Protect and track downloads on WordPress... What are you waiting for?