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.
Related Posts:
- How to store post ID’s in cookie or session to display the same posts later
- iframe does not store session/cookie when refresh parent
- $_SESSION variable not saving on page refresh or new page
- Set cookie parameters on wp site – PHP not working?
- Use WP user status (logged_in) to manage access to independent application
- ajax polling with admin-ajax.php
- WordPress load javascript file if something… (after the page is loaded)
- Serve cookie free URLs in WordPress without using a CDN
- Allow user to select location and then set cookie for location in WordPress
- Losing Session ID and sessionStorage when navigating to other domains on Multisite
- JqueryUi Dialog giving Uncaught TypeError: this._addClass is not a function error
- WordPress Infinite Scroll without using any plugin
- WordPress customizer: load controls in a custom div
- Ajax template: how to handle head section
- Run shortcode at certain resolution
- Passing PHP Variables to JS using Localize Script
- Understanding WordPress child theme custom JS loading
- Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions
- Javascript code inside “” in core WordPress files .php
- Site Health : An active PHP session was detected
- javaScript in section of WP API
- How can I add an alert (like the old javascript alerts) to my WP page?
- AJAX request status 200 but no actual “response”
- Adding custom directory and PHP files in wordpress
- Ajax – Call to undefined function get_option()
- JS file work only in index page
- Save Search System
- dynamic dependent select dropdown
- how can i use $_COOKIE[] + PostID to execute the below code?
- Ajax load more button for comments wordpress
- How to pre populate a form field with a link of a current user’s author profile?
- parts of url disappear when using # inside href=”” [closed]
- How to pass Select value from Javascript to PHP to generate select option on change
- WordPress Scripts Being Loaded in Footer
- Unique session WordPress
- How do I Import / Upload Files with jQuery AJAX?
- Noscript not working as it should in wordpress site
- PHP echo inside javascript
- How to add API security keys into JS of wordpress securely
- HTML escaping data with ajax requests
- load ajax using admin-ajax.php
- My php code is not being executed
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- How to use wordpress function wp_enqueue_script() in php?
- $_SESSION variables work perfectly on my local machine but returns NULL on development webserver
- Get related product based on subcategory selected from category id with ID 142
- wp_nav_menu not working correctly in my underscores theme
- url_to_postid returns 0
- How do i add slugs to a URL, but still redirecting to the same page
- How to set cookies
- Link to page with posts of specific type
- implementing a jQuery “click to expand” link in WordPress [closed]
- random reason on refresh
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- Load Javascript for a widget WordPress
- Some problems in custom widget
- Call a function in functions.php from within tags (JS)
- Hook on file upload
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- WordPress Search Ajax + Isotope + InfiniteScroll
- WordPress User Meta value variable into Google Gauge Chart
- duplicate posts with ajax load more wordpress
- How to populate a Gutenberg select field SelectControl with option value from PHP array
- Send an e-mail on address with the link with disliked post
- Are there any drawbacks on opening a session_start in functions.php and header.php?
- How to call my PHP function with AJAX ? wp_query
- Fetch Data from an external MSSQL Database in a Managed WP hosting
- Using Google Analytics in an enqueued JS file
- Create a WordPress Contact Form to call a POST AWS API Gateway and send user data
- Admin-ajax.php 404 error
- How to pass values from one function to the other using an array variable
- separate list of programs in html/javascript coming from php
- IF statement not working – Any suggestions?
- $.ajax results in 403 forbidden
- Filter portforlio with librairie isotop
- Target a specific container to style on WordPress storefront theme
- ACF + WP + Slick Slider Repeater Slide Group PHP not Displaying [closed]
- Default Image not showing up in Customizer for WP_Customize_Cropped_Image_Control
- How to create a radio button to alt between settings in wp_options table
- customizer live preview layout picker
- Why I’m Not Having Access to “$_POST” Data Outside My AJAX Callback?
- I need help implement a Javascript code into the PHP file
- Admin bar nodes
- How can I correctly POST to a WordPress page?
- if is_home(), change class of menu-item-225 of wp_nav_menu
- Load php function with AJAX on modal window
- JSON Object Value Show Undefine
- Require Credits Footer
- Adding jquery using php function
- How to hide .js files on wordpress website using php or wp plugins or any? [closed]
- How to transfer session after being redirected to other page
- Keep users logged in Without Remember Me
- Import js variables loaded via wp_localize_script() into js module without global scope connection
- Remove Woocommerce product from cart with ajax/fetch
- WooCommerce Modal Fly cart on add to cart – With AJAX
- PHP – Having $_SESSION as an array and adding $_SESSION to array
- I can’t log into my website , it says “Error: Cookies are blocked due to unexpected output”
- hiddenQuestions.find is not a function
- get_post_meta returns on side but it doesn’t return on bottom of admin page