You haven’t posted any code so I won’t be able to precisely post an answer for you, but this it what you can do.
Find the page that is rendering the profiles, open it and add this piece of code in it:
<?php
$user_info = get_userdata($id);
$role = $user_info->roles;
if ($role =='corporates' && !is_user_logged_in()) {
wp_safe_redirect( site_url());
exit;
}
?>
Which $id is the user id of the profile owner, not the visitor.
If you add more technical information about your problem I will update the answer for you.
Related Posts:
- How to allow an user role to create a new user under a role which lower than his level only?
- What the user_status column?
- How to customize wp_signon()
- Displaying different in-page content to cliente/admin
- Customising “user ids” and add to ‘user’ panel in the admin area
- If the current user is an administrator or editor
- Remove Ability for Other Users to View Administrator in User List?
- Display user registration date
- Allowing users to edit only their page and nobody else’s
- alphabetically order role drop-down selection in dashboard
- WordPress auto login after registration not working
- Execute a function when admin changes the user role
- How to let contributors to create a new revision(draft) editing their published posts
- How to set up User email verification after Signup?
- How to hide media uploads by other users in the Media menu?
- Show admin bar only for some USERS roles
- How to check user role without using current_user_can()
- Multi-steps WordPress registration : in 4 steps how to?
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- Force users to complete their profile after they register? How to
- How to enable the theme editor cap for an editor role?
- How to assign capabilities to user NOT to User Role
- Prevent user creating new users with specific roles
- How do i auto approve new user?
- BuddyPress | Check if user is in current group [closed]
- Return ID of authors who have at least one post
- How-to Delay The Capability To Publish Posts?
- Limit content by user registration date
- What is the best way to avoid spammers registering to my blog?
- WP_User->add_role producing unexpected results
- How can I check if the admin bar is visible to the current user?
- Set default page for user account in admin
- WPMU – new users are automatically subscribed to the main blog – how to prevent that?
- Create not-activated user in code, wordpress
- Hide everything on site for visitors except specific page IDs
- Get User Role by ID not working
- the_author_meta(‘user_url’, $author->ID) not working properly. how can I solve this?
- Managing Users and Creating Groups [closed]
- Plugin for limiting user registration based on ip with expiry period?
- Restricted registrations or removing the ability to edit your password/email
- Can user login details be used for other applications?
- Updating wp_user_level on user update
- Should I encrypt the response that triggers an Ajax action? Is nonce sufficient?
- Fix permissions for users role
- How can I attach a user to another user with user meta
- How can I allow an User to publish only 5 posts per month?
- Add a role and give admin priviledges
- Where are $current_user->allcaps set?
- How change user type from contributor to author
- Menu page with list of users
- Does wordpress support natively the concept of logging-in users? (not admins, but users of the website)
- How to set custom avatar for users?
- How many people are allowed to use same wordpress account at the same time?
- How to add registration date and last login date to user list page
- How to hide user profile fields based on the role of the viewed user?
- Allow Users to Modify Some Values of Assigned WordPress Pods [closed]
- Can I Create a Second Admin Level User Role?
- Custom registration and pending approval
- Automatic Website user password generation
- List all users and current week entries
- Groups and subgroups for permission
- how do I add role and capability after I create a new user
- Get Authors Role
- Edit text of WordPress “Register” button
- WordPress user role with create user capability?
- User with same Mail but a different additional info(like domain)
- User can’t search himself on rest api
- Perform multiple actions after wp_insert_user()
- Update user role for expired membership
- Easily adding multiple existing users to a multisite site
- How to hide “Change role to” dropdown on Users admin menu
- Hook into add_user_role and update based on new and removed roles
- How to Moderate Edits to User Profiles?
- Auto approve new users if their username is included in a predefined list
- Create relationships between users or user roles
- Updated user role inncorrect when using wp_get_current_user()
- User Permissions on custom post type
- Insert user register into my own user table instead of wp own user
- What is the best user experience for user to perform an action using email?
- Custom registration fields not appearing in user info
- Registration page as homepage
- Show user details only
- A different role for each site in a multisite
- WordPress install checking permissions of user id 0
- Access level seems to have gone from admin to editor
- New User ID not working in custom function with user_register hook
- Limit roles displayed in users.php depending on custom role
- Creating Custom user type just like custom post
- Let admin users edit member profiles from front end
- Control Category of each user can post
- file upload user profile
- how can i inform other users about new user registration? [closed]
- current_user_can() returning true for capability when the user and role do not have the capability
- Redirect user based on role when they try access a particular page
- How to create a specific role to manage users
- MySQL query to list users who never signed in
- Send email to user if their role is changed to Author
- WordPress password as plain text in email
- How to remove/limit Editor accounts privileges, to prevent them from deleting media and pages created by Admin
- Redirect Login Based on User Role