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 plugin or resource for custom implementation for OAUTH and regular user login?
- Login cookies set as wrong domain
- edit_user_profile and show_user_profile are not firing inside a class
- How to use login_redirect with a user capability
- Login Customizer doesn’t change the background of the register form
- easy steps to make front end form without plugin
- How to create multiple users at once?
- Shortcode to update user meta
- Change wp-login to custom URL login page
- Multisite – maximum number of users with specific role
- How do I get the user ID of the user that was updated in WordPress?
- Understanding State in WordPress Multisites
- How to have sample page for each new register users in a membership website
- 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?
- Too many login attempts
- 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()
- Custom Login Page — wp_signon Headers Already Sent?
- Is there a plugin for WordPress for creating ‘Accounts’ where all users who belong to that Account can only see Account data? [closed]
- Add User Role: Pre-saved in User-Meta [SOLVED]
- 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]
- How limit user connection?
- 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?
- How to pass a query string to another page on the same site?
- WordPress /users/me endpoint request forbidden
- Mutliple users editing single document in wordspress
- Custom PHP Page Using WordPress login
- Remove specific administrator’s capability
- How to Use the Filter “sidebar_login_widget_form_args”
- Plugin permissions for Editor role
- Personalized Author Area
- Manage PDF downloads and protected pages
- How to auto strip hyperlinks & images in wordpress post
- 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?
- Role based permission edit for plugins
- login in wordpress using gmail account
- Creating teams of users in WordPress
- WordPress plugin for Limited days user
- Plugin privelages for “editors”
- How can I replace content on site generated from plugin without changing plugin
- Shortcode not displaying HTML within the function
- Can’t save changes or modify settings in Dashboard but Pages and Posts are fine
- Disable Author Archive just for certain roles in bulk
- 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,
- force logged in user to stay in the dashboard
- Can we hide a certain user in WP?
- Share login credential with QR code
- How to implement data residency in my WordPress site
- Which membership plugin for a simple sign in? Personal areas for customers
- how to create user profile pages and display them based on users roles
- Discern a specific plugin’s action hooks
- Clean old users
- After reading 3 story by user ask for subscription popup
- User updating their profile wipes my custom fields
- Login/password protected “client page”
- WordPress Admin login redirect to homepage
- Comment restrictions Wodpress
- 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 do I run my custom function in my plugin when a wordpress user is deleted?
- How can I show login popup when user clicks on download button
- When the user entered an unauthorized url redirect to login page
- 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
- Why does WordPress use cookies for /wp-admin and /wp-content/plugins for non-admin users [duplicate]
- User / membership Plugin [closed]
- How to see in Edit Comments if comment is from User and her Roles
- Custom User Notice Upon Login
- 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?
- 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
- How to order users alphabetically by name? in plugin UPME
- User content database [closed]
- Users Ultra: Hide asterisk for required registration fields?
- Defined user role to access plugin’s pages
- Auto-login from backend