Created
January 26, 2026 21:31
-
-
Save hivepress/6982eb2b0b2c912ef2f6429ffe331e2f to your computer and use it in GitHub Desktop.
Hide the vendor pages from non-registered users (redirect to login form) #hivepress #vendors
This file contains hidden or 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
| <?php | |
| add_action( | |
| 'template_redirect', | |
| function() { | |
| if ( ! is_user_logged_in() && in_array( hivepress()->router->get_current_route_name(), [ 'vendor_view_page', 'vendors_view_page' ] ) ) { | |
| wp_safe_redirect( hivepress()->router->get_return_url( 'user_login_page' ) ); | |
| exit; | |
| } | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment