Skip to content

Instantly share code, notes, and snippets.

@MaryOJob
Forked from andrewlimaza/my_logout_go_home.php
Last active January 6, 2023 23:43
Show Gist options
  • Save MaryOJob/92630c34653699982ba8c228419b2219 to your computer and use it in GitHub Desktop.
Save MaryOJob/92630c34653699982ba8c228419b2219 to your computer and use it in GitHub Desktop.
Redirect users to a specified page when logging out of your WordPress PMPro site
<?php // DO NOT COPY THIS LINE
//copy lines 5 onwards into your active theme's function.php or custom plugin for code snippets.
function mypmpro_redirect_logout(){
// wp_safe_redirect( '/contact/' ); // use this line to redirect to a specific page on your site
wp_safe_redirect( home_url() ); // use this to redirect to your website home page
exit();
}
add_action('wp_logout','mypmpro_redirect_logout');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment