Forked from strangerstudios/my_pmpro_getfile_before_error.php
Last active
September 21, 2018 20:28
-
-
Save pbrocks/22362ae5294cb83708499948b3aae045 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
<?php // do not include in Customizations plugin | |
/** | |
* Redirect to the levels page when users try to access protected files in PMPro. | |
* | |
* Add this code to your customizations plugin file. | |
* | |
* Learn about protecting files with PMPro here: | |
* https://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