For some reason this is really vexing me! It should be simple for someone who knows what they are doing? Basically ….

I have setup a sort of ‘Profile’ based website in WordPress. Essentially new signed up users become ‘Members’ (just a derivative of a Subscriber) and purposefully can only see their own profiles. This functionality is dealt with by Ultimate Members plugin.

Within their profiles are links to a custom post called Sessions. Sessions are added by admin and then assigned to the right user with the Author tag. All of this is great – just one problem ……

Once the session is clicked and single-sessions.php loads up – it produces a URL such as mywebsite.com/sessions/joe-blogs-session-1. If I now take that URL & paste it to a new browser whilst changing the username to another user, I can now see their session. This is a big no no!

What I need is some kind of array which acts like:

If Author Name = Display name
{
then show page
}
{

else re-direct to ‘sorry’ page

}

Could anyone tell me how to go about this? I cannot seem to get it to work!

Thanks in advance

Read more here: Only show post if Author matches Logged in User


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: