Action Reference

after_download

1 min read Updated Jan 30, 2026

Description


This hook is triggered after package download is complete. If you want to manually count the number of downloads of a package or if you want to notify admin you can use this hook.

Parameters


One parameter/argument is passed to this hook.

Usage


<?php add_action("after_download", "download_notification",10,1);?>

Examples


<?phpadd_action("after_download", "download_notification",10,1); function download_notification($package){    $package_data = get_post($package['ID']);    $headers = 'From: Site Name <noreply@sitename.com>' . "";    $headers .= 'Content-type: text/html' . "";    $message = "Downloader's IP: ". $_SERVER['REMOTE_ADDR'];    wp_mail(get_option("admin_email"), "Download Notification: ".$package_data->post_title, $message, $headers); } ?>

Related


Action Hooks

before_download