Last active
September 13, 2018 14:54
-
-
Save strangerstudios/1ba6e28d0e58689602bd to your computer and use it in GitHub Desktop.
Use pmpro_getfile_before_error to tell PMPro to do something else besides send a 503 when accessing a member file. Requires PMPro 1.7.15+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Redirect to the levels page when users try to access protected files in PMPro. | |
Add this code to a custom plugin or your active theme's functions.php file. | |
Learn about protecting files with PMPro here: | |
http://www.paidmembershipspro.com/locking-down-protecting-files-with-pmpro/ | |
*/ | |
function my_pmpro_getfile_before_error($filename) | |
{ | |
wp_redirect(pmpro_url('levels')); | |
exit; //need to exit at end of function to avoid sending the 503 | |
} | |
add_action('pmpro_getfile_before_error', 'my_pmpro_getfile_before_error'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment