1. Home
  2. Knowledge Base
  3. Custom Development
  4. Version Repository – num_rows
  1. Home
  2. Knowledge Base
  3. Version Repository
  4. Version Repository – num_rows

Version Repository – num_rows

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. num_rows is a method of Download Monitor’s version repository service. The method returns the number of versions found for given filters. Useful for when you want to paginate your results for example.


[wpkb_code lang=”php”]public function num_rows( $filters=array() );[/wpkb_code]


$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.


Retrieve how many downloads in total the website has

This snippet will fetch an int containing the total versions the download with ID 4 has.

[wpkb_code lang=”php”]
$num_rows = download_monitor()->service( ‘version_repository’ )->num_rows( array( ‘post_parent’ => 4 ) );

Did you know! The retrieve() method uses the same $filters argument as this method. See the documentation page of retrieve() for more examples on various filter examples.

Was this article helpful?

Related Articles