Allows developers to modify the Content-Disposition header for restricted files served by Paid Memberships Pro. By default, images are displayed inline in the browser, while non-image files are downloaded as attachments.

apply_filters( 'pmpro_restricted_file_content_disposition', $content_disposition, $file, $file_dir, $file_path );

This filter lets you control how restricted files are presented to users. The default behavior sets Content-Disposition: inline for image files (image/*) and Content-Disposition: attachment for all other file types. You can use this filter to always force download behavior, or to allow inline display for additional MIME types such as PDFs or videos.

Parameters

$content_disposition
string; The default content disposition for the restricted file, either inline or attachment.
$file
string; The name of the restricted file being accessed.
$file_dir
string; The directory path to the restricted file.
$file_path
string; The full filesystem path to the restricted file.

Source

File: https://github.com/strangerstudios/paid-memberships-pro/blob/master/includes/restricted-files.php

View in Source Code

About Actions and Filters in PMPro

Hooks allow you to extend Paid Memberships Pro without editing any core plugin files. You can use a hook to program custom code that interacts with or modifies code in our plugin, Add Ons, your theme, and even WordPress itself.

There are two kinds of hooks: actions and filters.

  • Action hooks allow you to run new custom code at pre-defined locations.
  • Filter hooks allow you to change or extend existing code by modifying the data and returning it back to the software.

Click here to browse the full database of action and filter hooks available in Paid Memberships Pro. For help extending our Add Ons, refer to the individual Add On's documentation page for a list of available hooks.

For more developer-focused information about Paid Memberships Pro, check out the advanced developer topics documentation.

Was this article helpful?
YesNo