View Categories

Download Plugins and Themes: Developer Hooks and Filters Reference

Developer hooks and filters reference #

Download Plugins and Themes in ZIP from Dashboard exposes a small but real developer surface: one action, four public filters, two WP-Cron events and a set of custom cron intervals. Every hook listed here is called from shipping code, so a callback you register runs exactly where the plugin runs it. This page is a reference for developers extending Download Plugins and Themes; the settings themselves are covered in the plugin documentation.

All option keys referenced below are stored with the prefix alg_download_plugins_dashboard_. For example, the “Add plugin directory” toggle is stored as alg_download_plugins_dashboard_plugins_add_main_dir.

Action #

Action Arguments Fires when
alg_download_plugins_after_download $zip_file_path Right after a ZIP has been streamed to the browser, inside send_file(). This covers per-item downloads, the “Download all” tools and the Pro bulk “Download ZIP” action. It does not fire for periodical (scheduled) downloads, which write to disk instead of streaming.

The Pro version uses this action to power the Auto Delete ZIP files option: it deletes the served file from the temporary directory once the download finishes. You can hook it to copy the archive elsewhere, log the event, or push it to remote storage.

add_action( 'alg_download_plugins_after_download', function ( $zip_file_path ) {
    // Copy every served archive to an off-site backup folder.
    copy( $zip_file_path, '/mnt/backups/' . basename( $zip_file_path ) );
} );

Filters #

Filter Filtered value Purpose
alg_download_plugins_download_plugin_btn_text 'Download ZIP' The text of the per-plugin download link on the Plugins screen. In Pro this filter returns the value of the Text setting (download_plugin_btn_text).
alg_download_plugins_version_separator_char '.' The single character placed between a plugin or theme name and its version in the ZIP filename. The plugin itself returns the Version separator character setting; only the first character is used.
alg_download_plugins_plugins_bulk_period '' The cron interval used to schedule periodical plugin downloads. An empty string means “do not schedule”. In Pro this returns the Periodical plugins downloads setting.
alg_download_plugins_themes_bulk_period '' The cron interval used to schedule periodical theme downloads. Same contract as the plugins variant.
alg_download_plugins_settings varies Used throughout the settings screen to unlock the Pro-only fields and strip the upsell copy. In the free build it returns disabled, which disables every Pro field; the Pro build removes that behavior.
add_filter( 'alg_download_plugins_download_plugin_btn_text', function ( $text ) {
    return 'Export ZIP';
} );

Use a different version separator #

By default a plugin named my-plugin at version 2.0.0 is packaged as my-plugin.2.0.0.zip. Return a different character to change that. Only the first character of the returned string is applied.

add_filter( 'alg_download_plugins_version_separator_char', function ( $char ) {
    return '-'; // my-plugin-2.0.0.zip
} );

Note: the plugin’s own core registers a callback on alg_download_plugins_version_separator_char that returns the saved setting. If you add your own callback, run it at a later priority so it takes precedence, or clear the option first.

Cron events and custom intervals #

Periodical downloads run on two WP-Cron events. They are (un)scheduled on plugin activation and deactivation, and again whenever you change a period setting.

Cron event Runs
alg_download_plugins_cron The periodical plugins download (equivalent to clicking Run now for plugins).
alg_download_themes_cron The periodical themes download.

The plugin registers three custom cron intervals (in addition to WordPress’s built-in hourly, twicedaily and daily) via the cron_schedules filter:

Interval key Seconds Display
minutely 60 Once a Minute
weekly 604800 Once Weekly
four_weeks 2419200 Every 4 Weeks

Run a schedule not offered in the settings #

The period filters accept any valid cron interval key. To download plugins on a schedule not listed in the dropdown, return the interval key of a schedule you have registered (or a built-in one):

add_filter( 'alg_download_plugins_plugins_bulk_period', function ( $interval ) {
    return 'daily';
} );

Because a changed period only reschedules the cron event when it is saved on the settings screen, clear and re-arm the event after adding a filter like this:

wp_clear_scheduled_hook( 'alg_download_plugins_cron' );
if ( ! wp_next_scheduled( 'alg_download_plugins_cron' ) ) {
    wp_schedule_event( time(), 'daily', 'alg_download_plugins_cron' );
}

Capabilities #

The download endpoints are capability-gated. If you build tooling on top of them, respect the same checks:

  • Plugin downloads (per item, Download all, bulk, periodical) require activate_plugins.
  • Theme downloads (per item, Download all, periodical) require switch_themes.

Need a hand? #

Questions about extending Download Plugins and Themes? Our developers answer every ticket on the support forum.