Service class that containing the helper functions in order to interact with the private links.
Class PDA_Private_Link_Services
| package |
pda_services |
|---|
create_private_link(integer $attachment_id, array $data, $use_raw_url = true) : string
integerThe attachment's id.
array(optional) Array structure to define additional information for the private links.
$data = [
'expired_days' => (integer) The number of days the private link will expire from the created day.
'limit_downloads' => (integer) The max number of times that link can be downloaded.
]
Example:
$data = [
'expired_days' => 5,
'limit_downloads' => 3,
]
Happy coding.
stringReturn empty string if the attachment file is not protected, otherwise return the new private link.
protect_file(integer $attachment_id) : boolean|\WP_Error
integerThe attachment's id.
boolean|\WP_Error