• Resolved p4ssc3

    (@passce)


    Hi,

    I’m searching a snippet to hide some custom URL to no-logged users (I use a event plugin which generate category page of events, i would like hide this pages as well as other casual pages)

    Thanks !

Viewing 1 replies (of 1 total)
  • Plugin Author Caseproof

    (@caseproof)

    Hi @passce

    Members plugin doesn’t support Custom URI protection, but if you want to hide post of custom post type, you can use this code snippet and modify it to fit your needs:

    
    add_action( 'template_redirect', function() {
      // Redirect users when they are not logged in
      // and it is one of the post of the custom post type: event
      // Replace it with slug of event plugin
      if ( is_page('contact') && ! is_user_logged_in() ) {
        $redirect = 'https://your-domain.com/unauthorized'; // Change this to the correct URL
        wp_redirect( $redirect );
        exit;
      }
    } );

    Hopefully, that helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Hide Custom Page’ is closed to new replies.