User roles established by site entry URL/cookie possible?


I have a use case to present different content and products to different, casual visitors of the general public WITHOUT them first creating an account or needing to login (if returning), preferably based on the entry URL.

User roles seems to be the feature of WordPress on which most plugins that control content accessibility hinge, but that requires user accounts.

Is there a way, when a user visits the site with a specific URL, to establish them temporarily (and for future sessions also via a cookie, possibly) as a part of a specific user role, sans account, so we can control content accessibility, and for maximum flexibility use any plugins that offer other features based on user roles/user role functions?

If there is some other feature, what is it? Searches have mostly been dead ends as they all lead to user roles and assume accounts for managing roles/access.

(I mentioned cookies. For the sake of discussion, let’s just assume that cookies are enabled, or that we’ll persuade the user to allow them. Cookies are clearly necessary for this idea to work properly across sessions, since state can’t be maintained, and accounts are undesirable.)

(Also, for our purposes, this is strictly for READ-ONLY capabilities/roles, but I can see how a feature like this could be problematic if not properly configured (granting admin user role without authentication sounds like maybe the worst idea in the history of WordPress—if such a thing is even possible).


joshjellel 2 months 0 Answers 12 views 0

Leave an answer