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
- Is there a way (plugin?) to restrict a user to being able to edit just one page?
- Where the Nickname is being used in WordPress
- Keep one user logged for a year?
- User-Specific Timezones? Hack? Plugin?
- How to get user-meta from Social Login registered users?
- Which hook should be used to validate custom form fields on the login form?
- Tracking last login and last visit
- Removing user contact methods works from functions.php but not from a plugin
- Prevent Brute Force Attack
- Login with email (WP Modal Login)
- Check if the front end user is log in or not
- Removing WordPress Plugin Menu Item for a specific user
- How to create a word press user with hashedpassword
- How to expire all wordpress user passwords instantly?
- How to show popup to a group of users?
- Mass Import Users without sending new user notification
- WordPress login with Phone Number [closed]
- wp_authenticate but not logged in
- update_user_meta add value on the top on existing value
- Reset WordPress website
- How to transfer all user data between wordpress installations?
- Getting user roles in plugin files
- Auto delete WordPress users according to time
- How to associate more than one user to a post?
- How do i login when i cant access wp-login.php?
- Single central login for front end users from any site
- How to create user groups and allow custom posts and plugin modify/access to specific group?
- WordPress Central User Database
- How to read individual user’s directory and display content to that specific user?
- Plugin: Google Analytics for Dashboard error – Timestamp is too far from current time
- wp_set_auth_cookie causes 403 error in the wooCommerce checkout
- How can I copy all users to newly created site on a multisite network in WordPress?
- Enable users to change change and add taxonomies of posts
- Login Customizer doesn’t change the background of the register form
- How to create multiple users at once?
- Shortcode to update user meta
- Change wp-login to custom URL login page
- How do I get the user ID of the user that was updated in WordPress?
- How to get all posts belongs to a user between a certain date
- how can I query all wordpress users of a blog
- Get ‘Headers already sent’ error for the plugin I am creating when I try to login
- Add Content to Content()
- get_users(); Is an Undefined Function When Used in Cron Job
- Theme My Login Shortcode Doesn’t Return Anything
- 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
- Custom Login page with custom redirects for each user?
- how to make dynamic subdomain for each user registering?
- Mutliple users editing single document in wordspress
- Plugin permissions for Editor role
- Completely remove ability to create users?
- Role based permission edit for plugins
- WordPress plugin for Limited days user
- Linking form to user meta fields
- Auto populate a user custom field from another user custom field
- WordPress Multisite Profile Picture Sync Error with Nextend Social Login Plugin
- Plugin or ways to limit number of users logging in the website,
- Which membership plugin for a simple sign in? Personal areas for customers
- Discern a specific plugin’s action hooks
- Clean old users
- Login/password protected “client page”
- WordPress Admin login redirect to homepage
- How To Export User’s Custom Fields in CSV or XLSX
- Get all user meta_keys and then group users by matching values
- https rewrite not working for All in one security Brute force > rename login url
- Searchable Semi Random Number Generator on User Profiles
- How to show private pages based on a user’s role?
- How can I store user preferences in WordPress and retreive them later?
- Simulate Update User button click
- Update User Meta Via Ajax
- User Following System
- wp_signon returns user, in popup window, but the user is not logged in
- Paid Memberships Pro, Display User Limit
- wp_login_form() ignoring login_form action hook
- Confusing problem with displaying message recipient metadata
- Every time I use wp_get_current_user() my plugin breaks
- Users Ultra: Hide asterisk for required registration fields?
- AJAX login without a plugin does not work. when add a action to function.php
- wp-admin will not redirect to wp-login.php
- Adding google authenticator and use only email address of user
- how to protect wordpress website
- WordPress ReAuth =1 Loop with wpCAS
- Advice on setting up private site
- Checking url from plugin [duplicate]
- Change All Login/Signup Links in Plugin
- plugin for different writers [closed]
- User register hook can’t access form request
- How to resolve these findings from security audit
- How to make wordpress backend mobile optimized.?
- ERROR: Cookies are blocked due to unexpected output – no access to FTP
- How to give different user access to different people?
- How to Find WordPress site has backdoor login Codes
- How to create a custom wordpress plugin for a specific functionality?
- how to embed a crop feature for cropping images uploaded by the user
- Share or sync user table data with another user table
- WordPress Homepage Login
- I cannot login after installing the wp-login timeout setting plugin