I'm trying to login users in wordpress through an API of another platform, so what I do is use an ajax function to call an external API sending the user credentials (username, password) and getting back the user info: (email, id, name...).

What I need is login the mentioned users in my wordpress website, but without save them (register them) in the wordpress database, so I'm not able to use any 'user role plugin' in order to administrate the visibility of pages/posts.

So, my goal is: Make pages/post and even menus only visibles for this external users when they are logged in my wordpress site, but without save them in the database.

I think that maybe using variable sessions or my own check\_user\_login() function, but I'm not sure how could I achieve this (where should I validate certain pages to set them visible only for logged in users?), because even if I have experience in PHP, it's my first time using wordpress.

I'm just asking for ideas, so it's because of that I'm not posting any code for now.

Thanks again for your help.