Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Show app-data posts only to app users
- function user_redirect()
- {
- if ( is_category( 'app-data' ) ) {
- $url = site_url();
- wp_redirect( $url );
- exit();
- }
- }
- add_action( 'the_post', 'user_redirect' );
- function redirect_not_app_users_if_app_data_category() {
- if ( (is_category( 'app-data' ) || in_category('app-data'))&& ! is_user_logged_in() ) {
- wp_redirect( home_url() );
- die;
- }
- }
- add_action( 'template_redirect', 'redirect_not_app_users_if_app_data_category');
- add_action( 'template_redirect', 'wpse_restrict_catgorey');
- function wpse_restrict_catgorey(){
- if( ! is_user_logged_in() && is_category( 'app-data' ) ) {
- wp_redirect( home_url() );
- exit;
- }
- }
Add Comment
Please, Sign In to add comment