Skip to content

Instantly share code, notes, and snippets.

@ideadude
ideadude / my_pmpro_getfile.php
Created September 15, 2021 15:49
Lock down non-WordPress files in *multiple private directories* with Paid Memberships Pro.
<?php
/*
This code handles loading a file from one or more protected directories.
This is a variation of the code presented here:
https://www.paidmembershipspro.com/locking-non-wordpress-files-folders-paid-memberships-pro/
(!) Be sure to change the $protected_directories arary below.
(!) Add this code to a code snippet or custom plugin.
(!) You should have a corresponding bit of code in your Apache .htaccess file
to redirect files to this script. You need one line per protected dir.
###