Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Last active September 13, 2018 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save strangerstudios/1ba6e28d0e58689602bd to your computer and use it in GitHub Desktop.
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+
/*
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