You’ll need to find out what theme template file is being used to display the /portfolio/ page – page.php, page-portfolio.php, tpl-portfolio.php, or something along those lines.
Then, if you don’t already have a child theme, create one.
Then, copy the template file into your child theme, and at the very top – before anything else – add:
// If the user is not logged in
if( !is_user_logged_in() ) {
// send them to the login screen
// once they log in, they will automatically return to this page
auth_redirect();
} else {
// move all your other code into this condition
}
As the comments note, if the user isn’t logged in, they’ll be redirected to the login page. Once they are logged in, they’ll be redirected back to the portfolio page.
Related Posts:
- How to create custom LOGIN and REGISTRATION forms?
- Janrain/Simple Modal under Redirected Domain
- WP_User_Query and non-unique usermeta data
- Loading posts associated only to the logged in user on recent posts page
- Change success message in plugin Theme my login
- How can i force Display names to be the same as Usernames?
- How to get Login Error messages on a custom template
- How can a Firebase user registration and login be integrated into a WordPress site?
- How to get user-meta from Social Login registered users?
- Auto login using Active Directory and Windows Authentication
- How can I make content disappear when a user logs in?
- Tracking last login and last visit
- login to wordpress with Get variables instead of Post
- $current_user var returns NULL
- Multisite functions to communicate with individual site functions
- WordPress Plugin for One-Time Event Registration? [closed]
- Will WordPress username displayed somewhere in the site?
- wordpress custom login successful redirect hook
- WordPress with CAS+LDAP and standard WP accounts
- Upload files programmatically to users
- How to show popup to a group of users?
- Current user in plugin returns NULL
- wp_authenticate but not logged in
- update_user_meta add value on the top on existing value
- Force [wordpress_social_login] shortcode to display where it is embedded [closed]
- Cannot login to ADMIN even after changing password in phpmyadmin
- How to upload user profile image from frontend in wordpress ?
- Average Account Age
- How do i login when i cant access wp-login.php?
- How to keep users unique id stored in session in addition to IP in WordPress plugin?
- Why is my staging subdomain not sending wordpress_logged_in cookies?
- New User Form – Custom Menu Page
- How can I force users to a particular subdomain to log in for MU (Multisite)?
- How to save generated JWT token to cookies on login?
- Contributive page where people logged in can write
- How to create restrict content to users (by user, not by role)
- Custom User meta field display
- Login cookies set as wrong domain
- edit_user_profile and show_user_profile are not firing inside a class
- Login Customizer doesn’t change the background of the register form
- Multisite – maximum number of users with specific role
- How to get all posts belongs to a user between a certain date
- Login problem after installing my written plugin [closed]
- Specific way to allow WordPress users to view their current password? And edit it?
- Possibility to login without password
- how do i change my website facebook login button to another text immediately user login? [closed]
- WordPress unable to write files in the server
- how to make dynamic subdomain for each user registering?
- Custom PHP Page Using WordPress login
- Remove specific administrator’s capability
- How to Use the Filter “sidebar_login_widget_form_args”
- Personalized Author Area
- If I use an alternative login (e.g. CAS or other SSO) plugin, is my site protected from the recent brute force login attempts?
- Completely remove ability to create users?
- Creating teams of users in WordPress
- WordPress plugin for Limited days user
- How can I replace content on site generated from plugin without changing plugin
- Can’t save changes or modify settings in Dashboard but Pages and Posts are fine
- Linking form to user meta fields
- WordPress Multisite Profile Picture Sync Error with Nextend Social Login Plugin
- force logged in user to stay in the dashboard
- Share login credential with QR code
- How to implement data residency in my WordPress site
- Discern a specific plugin’s action hooks
- Clean old users
- User updating their profile wipes my custom fields
- WordPress Admin login redirect to homepage
- Comment restrictions Wodpress
- https rewrite not working for All in one security Brute force > rename login url
- When the user entered an unauthorized url redirect to login page
- Simulate Update User button click
- Update User Meta Via Ajax
- User Following System
- User / membership Plugin [closed]
- How to see in Edit Comments if comment is from User and her Roles
- using wordpress login details for other website / application / forum?
- How can I save cookies to members
- wp_signon returns user, in popup window, but the user is not logged in
- How to Create Custom Dashboard for my Laundry Website?
- Every time I use wp_get_current_user() my plugin breaks
- User content database [closed]
- Users Ultra: Hide asterisk for required registration fields?
- Defined user role to access plugin’s pages
- AJAX login without a plugin does not work. when add a action to function.php
- Plugins effecting layout & login
- Redirect default login page to a custom page [duplicate]
- First argument is expected to be a valid callback for cp_admin_init and _canonical_charset
- How to set different users for different pages?
- HTTP Error 403 When Trying to Login
- Change All Login/Signup Links in Plugin
- Want to add post to user dashboard
- How to make wordpress backend mobile optimized.?
- How to Find WordPress site has backdoor login Codes
- how to embed a crop feature for cropping images uploaded by the user
- How to give access to the particular page in wordpress for specific username/email NOT roles [closed]
- Share or sync user table data with another user table
- WordPress Homepage Login
- I cannot login after installing the wp-login timeout setting plugin
- Issue: Unable to Access WordPress Admin and Database Errors
- Lost Password of my site, how to reset wordpress password?