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.


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


Parameter Type Default Description
$filters array array() 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.
$limit int 0 Allows you to limit the amount of versions that are fetched.
$offset int 0 The offset specifies the offset of the first row to return. Allows you to skip given offset of versions in the result set.


Retrieve all versions of Download ID 9

This snippet retrieves all versions for download with ID 11.

$versions = download_monitor()->service( 'version_repository' )->retrieve(
		'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(
		'post_parent' => 11
Retrieving a single version can also be done with retrieve_single method.

Was this article helpful? Yes · No