The Protected Downloads Add On relies on the protected files and content restriction systems in Paid Memberships Pro, so most customizations use core hooks. This reference covers the filter the Add On applies plus the core and WordPress hooks that change how downloads behave.
Filters in the Add On
pmpro_membership_content_filter_disallowed_levels
Determines whether locked downloads show every level that has access, including levels that don’t allow new signups. By default those levels are hidden from the locked message and checkout link. Return true to show all levels. This is the same filter Paid Memberships Pro uses for its standard no-access message, so it changes both.
apply_filters( 'pmpro_membership_content_filter_disallowed_levels', bool $show_disallowed_levels, array $level_ids, array $level_names );
Parameters
$show_disallowed_levels: bool; Whether to show levels that don’t allow signups. Defaultfalse.$level_ids: array; IDs of the levels that can access the download.$level_names: array; Names of the levels that can access the download.
Paid Memberships Pro Hooks for Downloads
These hooks are part of Paid Memberships Pro. The Add On uses them to check access and serve files, so you can use them to customize downloads.
pmpro_has_membership_access_filter_pmpro_download
Filters whether a user can access a specific download. This controls the template the visitor sees, the download link in the editor, and whether the file is served. pmpro_download is the download post type, and the general pmpro_has_membership_access_filter filter runs first with the same parameters.
apply_filters( 'pmpro_has_membership_access_filter_pmpro_download', bool $hasaccess, WP_Post $mypost, WP_User $myuser, array $post_membership_levels );
Parameters
$hasaccess: bool; Whether the user has access.$mypost: WP_Post; The download post.$myuser: WP_User; The user being checked.$post_membership_levels: array; Level objects (withidandname) required for the download, from its own settings and its categories.
pmpro_can_access_restricted_file
Filters whether the current user can access a protected file. The Add On hooks in at priority 10 and returns the result of the download’s membership access check for files in the pmpro-downloads folder. To override it, use a later priority and check $file_dir.
apply_filters( 'pmpro_can_access_restricted_file', bool $can_access, string $file_dir, string $file );
Parameters
$can_access: bool; Whether the user can access the file. Defaultfalse.$file_dir: string; The protected folder name. Downloads usepmpro-downloads.$file: string; The stored file name.
pmpro_restricted_file_served
Fires after a protected file is sent to the visitor. The Add On doesn’t count or log downloads, so use this action to record downloads in your own table or analytics tool. Check that $file_dir is pmpro-downloads. $file matches the download’s _pmpro_download_stored_filename post meta. Callbacks must not output anything. Available in PMPro 3.7 and higher.
do_action( 'pmpro_restricted_file_served', string $file_dir, string $file );
Parameters
$file_dir: string; The protected folder name.$file: string; The stored file name that was served.
pmpro_restricted_file_content_disposition
Filters whether a protected file opens in the browser (inline) or downloads (attachment). By default images open inline and other files download. Return attachment to force image downloads to save to the visitor’s computer.
apply_filters( 'pmpro_restricted_file_content_disposition', string $content_disposition, string $file, string $file_dir, string $file_path );
Parameters
$content_disposition: string;inlinefor images,attachmentfor everything else.$file: string; The stored file name.$file_dir: string; The protected folder name.$file_path: string; The full server path to the file.
WordPress Shortcode Attribute Filters
The shortcodes pass their tag name to WordPress’s shortcode_atts(), so you can change attribute defaults with WordPress’s shortcode_atts_{$shortcode} filter. The blocks render through the same functions, so these filters apply to blocks too.
shortcode_atts_pmpro_download
Filters the attributes of the single download shortcode and block. For example, change the default template to card site-wide. Use shortcode_atts_pmpro_download_library for the Download Library.
apply_filters( 'shortcode_atts_pmpro_download', array $out, array $pairs, array $atts, string $shortcode );
Parameters
$out: array; The final attributes.$pairs: array; The supported attributes and their defaults.$atts: array; The attributes set on the shortcode or block.$shortcode: string; The shortcode name.
Get Support From Our Team of Experts
Have a question about how to use this feature? Our Support Page outlines three ways to get support.
Our Max plans include hands-on help customizing your membership site and implementing new features. Upgrade to PMPro Max now »
Last updated on November 9, 2026

