wpdm_get_package
2 min read
Updated Jan 26, 2026
Description:
Takes a package ID and returns the database record for that package.
Usage:
<?php wpdm_get_package($id); ?>
Return Value:
Return package data in an Array if package exists
Example:
To get the title for a post with ID 2:
<?php $package = wpdm_get_package(2); echo $package['post_title']; ?>
To get the download count:
<?php echo $package['download_count']; ?>
Using new API
If you want to load package data in an object, use the following code:
<?php $package = WPDM()->package->init($ID); ?>
Here are the variables in $package object you can access directly:
<?php
class Package
{
public $ID;
public $title;
public $description;
public $excerpt;
public $files;
public $post_status;
public $version;
public $publish_date;
public $publish_date_timestamp;
public $update_date;
public $update_date_timestamp;
public $avail_date;
public $expire_date;
public $link_label;
public $download_count;
public $view_count;
public $access;
public $author;
public $quota;
public $icon;
public $package_size;
}
?>
Show file list table:
<?php echo WPDM()->package->fileList->table($ID); ?>
File list extended:
<?php echo WPDM()->package->fileList->extended($ID, 400, 300, 4); ?>
Image gallery from attached images:
<?php echo WPDM()->package->fileList->imageGallery($ID, 400, 300, 4); ?>
Check if a package is locked:
<?php $locked = WPDM()->package->isLocked($ID); ?>
Check if a package is locked using a specific lock option ( ex: is terms locked? ):
<?php $must_agree_to_download = WPDM()->package->isLocked($ID, 'terms'); ?>
Check if a package is password protected:
<?php $password_protected = WPDM()->package->isPasswordProtected($ID); ?>