Last active
February 7, 2017 16:58
-
-
Save Basilakis/4cf84968527f48abd230ba4033117262 to your computer and use it in GitHub Desktop.
Redirect log - out users from Custom Post Type Singular
This file contains 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
function logedout_singular_redirect() { | |
if (!is_user_logged_in() && ( is_singular( 'job_listing' ) ) | |
) { | |
// feel free to customize the following line to suit your needs | |
wp_redirect(site_url('my-page-slug/')); | |
exit; | |
} | |
} | |
add_action('template_redirect', 'logedout_singular_redirect'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment