Display message once per session to users with a specific role

You can check whether this plugin helps you to achieve your purpose
or
You can write your own code in your custom plugin with the following approach:

  • Check if the user is logged in.
  • Check if the current user has the any roles from the specified list of roles which you want the notice to be shown.
  • If the above conditions are true just add a Notice to the site.

You might not be needing sessions as you check whether the user is logged in an show the message. If at all you need WordPress Sessions you can use the functions defined in the class WP_Session_Tokens.

Leave a Comment