Questions tagged [session]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
20 views

Flash messages for not logged in users

I want to use flash messages to deliver validation error notices. For people who are not familiar this means that the user sends the form, I process the POST data, I store the error messages ...
inf3rno's user avatar
  • 133
0 votes
0 answers
74 views

Session destroy on browser close in wordpress

Is there a hook for session destroying on browser or tab closing please guide me how to resolve this
gopi's user avatar
  • 1
0 votes
0 answers
221 views

PHP - Having $_SESSION as an array and adding $_SESSION to array

Originally, I wanted to have a $_SESSION that is linked to a button that when clicked, adds +1 to the $_SESSION. I was able to that, but could not find a way to display all of the clicks. It would ...
Jdubstep2345's user avatar
0 votes
0 answers
261 views

Block non logged in users from accessing the media library

I have a custom login page for a site I'm working on that isn't related to the backend login. The purpose of this is so users that aren't logged in cannot see the site. When the site loads it looks ...
justDan's user avatar
  • 101
0 votes
1 answer
59 views

Recognize logged WP user in existing REST API

I have a plugin using pre_get_post filter to hide posts depending on which user is logged. However the "parent page" selector in the WP "edit post" page uses a wp-json call to get ...
a-coder's user avatar
  • 400
-1 votes
1 answer
428 views

Wordpress keep logged in after browser close

I want my users to be logged in even after they close the browser. I have tried below code but nothing happens, it still logging me out after closing the browser. function keep_me_logged_in_for_1_year(...
Souvik Das's user avatar
0 votes
0 answers
127 views

How to transfer session after being redirected to other page

I am trying to display inputted fields on another page using sessions. I was able to display simple strings, but when I try and add data fields from my submitted form, it turns up blank. Any ...
John Lyons's user avatar
0 votes
1 answer
218 views

Authorize subdomain to access and read user and admin cookies

My subdomains redirect alls in the main domain . I am the admin. We can access to my website by the main domain or subdomain. I use that to share cookies between domain and subdomain : There is no ...
imagIne's user avatar
  • 53
0 votes
1 answer
519 views

Having Issue on Redirecting With Session in WordPress

I am trying to create a simple login system in WordPress using core PHP but I am getting this error message Warning: Cannot modify header information - headers already sent by (output started at /www/...
Suffii's user avatar
  • 201
0 votes
1 answer
119 views

Display if author page is author page of current user

in my multi author website I have a button that users can upload their avatars. I need to display this button in author page. I can do it. I added this button to author page. The problem is that ...
Teymur Abbasov's user avatar
0 votes
1 answer
503 views

add class to element if user is not logged in [closed]

Please help . I need to add class to this button if user is not logged in <?php echo apply_filters( 'my_order_html', '<button type="submit" class="ADD-CLASS-HERE cfw-primary-btn ...
Teymur Abbasov's user avatar
0 votes
1 answer
59 views

How to read and write session data?

My website requires users to complete their profile before they can place an order. So far, I have been able to redirect a user to his profile editing page if his profile is incompleted when he tries ...
shenkwen's user avatar
  • 131
0 votes
0 answers
86 views

Plugin is attempting to start a session with WordPress. WP Session Manager will not work! DomPdf

I get the error message "Another plugin is attempting to start a session with WordPress. WP Session Manager will not work! how to find error" I am trying to correct the code of somebody. He ...
user1664377's user avatar
0 votes
0 answers
26 views

Adding preference buttons to main nav that persist via user sessions. (Woocommerce)

I would prefer not installing a plugin to achieve this and I don't mind coding something myself. I'm simply unsure of the "wordpress-y" way to go about it. So here goes, Each one of the ...
LAZ's user avatar
  • 101
1 vote
1 answer
426 views

homepage redirects to login page when user session expires

WordPress 5.9 Users trying to access the homepage when the session expires, are sent to re-authenticate. The behavior seems weird since it only applies to the homepage. Users with expired sessions can ...
m1k3y3's user avatar
  • 115
0 votes
1 answer
1k views

Using session in WP without trouble with the API REST

I build a custom plugin that make me able to use SESSION to passe parameters from a page to others pages without GET parameters. This works very well. Basically i start my session like this : ...
djoo's user avatar
  • 157
0 votes
0 answers
64 views

Unable to execute Ajax request, status code 400

I'm running WordPress Network on Nginx Web Server and I'm facing some issues when any user tries to login. If the user tries to login without any of website earlier login data (cache and cookies), ...
AtomX's user avatar
  • 109
1 vote
0 answers
187 views

Why is the session clearing after wp_safe_redirect?

I've been pulling my hair out with this for months now, and it's causing many issues in several places. Can anyone tell me why after setting a $_SESSION variable, and then performing a ...
Lee's user avatar
  • 337
0 votes
1 answer
247 views

Plugin or ways to limit number of users logging in the website,

Would like to check if there is any way (or plugin) available that can: a.limit the number of concurrent users session by of user currently logged in to the website b.limit the number of users logging ...
BBBBB86's user avatar
  • 23
0 votes
1 answer
5k views

WooCommerce - set session with new cart item meta when updating cart item quantity [closed]

I'm trying to add meta data to cart items based on their quantity. It works all fine when I add the product to the cart, but I'm failing to update the cart item meta when the quantity is updated. I ...
photogenic's user avatar
0 votes
0 answers
201 views

Using sessions or an alternative in a plugin

I want to use sessions in a plugin, I use this code in my plugin to start a session add_action('init','register_session',1); function register_session(){ global $cons; if (session_status() === ...
George Viennas's user avatar
0 votes
0 answers
40 views

Restricting wordpress login sessions for a web app

I am creating a webgl unity app that sits on a wp site and uses the wp accounts to store data. It works really well, however an issue I have is that currently a user can be logged in on two machines ...
wdslatter's user avatar
0 votes
1 answer
871 views

How to change WordPress cookies to be session-only

I don't want my WP site to set any persistent cookies. Session cookies while I'm logged in are all I want to allow. I don't want to have to ask visitors for consent, so I need to be sure that none are ...
Synchro's user avatar
  • 101
1 vote
2 answers
976 views

How to implement a $_SESSION alternative in Wordpress inside a theme without a plugin?

I want to show a popup to the first time visitor of a Wordpress site. I tried to check the visit state using $_SESSION. Something like this in the footer.php: <?php if(!isset($_SESSION['pxpop'])) ...
sariDon's user avatar
  • 265
1 vote
1 answer
746 views

How to Extend login session times to a Month

How can I extend wordpress login sessions to a month so that it doesn’t automatically ask for login after 48 hours? I am basically testing some program with wordpress and around 48 hours it fails and ...
Mukeshwar Singh's user avatar
0 votes
1 answer
1k views

Session is not working properly

We have a questionnaire with a product configurator and we are saving the configuration for the user with a session. Somehow the session is not working properly. For some users it's just not saving ...
Anil's user avatar
  • 1
0 votes
0 answers
58 views

$_SESSION dosent't work

So when i use variable $_SESSION['wp_childs'] = $_POST['childs'] in my plugin, nothing changes in my storage session. i use session_start(); at the top of that all pages; for use $_SESSION but i can't ...
Griffont39's user avatar
0 votes
0 answers
64 views

Retrieve parameter from url

Given a certain url, custom = www.namesite.com/r=namerefferrer to initialize a $_SESSION and retrieve the value of this $_SESSION I did: I set this in functions.php: if (!session_id()) { ...
user14985037's user avatar
0 votes
1 answer
954 views

Like and Dislike Buttons on Post with Counter - Only allow one click per post per user session

Working on a "Like" vs "Dislike" for blog post in WordPress. While all is working fine, the intention here is to make it work for guests and logged in users, but more importantly; ...
Dominic Herold's user avatar
0 votes
1 answer
736 views

Multi-instance WordPress usingn Memcached to handle sessions requests login every time a requests is handled by a different server

I have WordPress running in Kubernetes with horizontal autoscaling, my site uses BuddyPress to provide social-networking functionality. I also have a memcached server accessed by all the deployments ...
Jesus Iniesta's user avatar
3 votes
5 answers
21k views

Site Health : An active PHP session was detected

I'm new in WordPress development and I just created my first theme. In my wp-admin, the "Site Health" tells me that a PHP session has been detected (critical error), here is the message : A ...
Loraga's user avatar
  • 101
0 votes
0 answers
77 views

End session screen not close automatically after login

I configured the login screen and the login process for my purposes. but there is an issue I don't know how to solve. after the session ends, there is a pop-up with a login screen called "wp-auth-...
szz's user avatar
  • 1
0 votes
0 answers
560 views

Correct user session/cookie handling with external site connection in wordpress

I have a wordpress + woocommerce site where the user can configure a product and create a custom one. The software that handle this configuration is on another server. So i need to send some data in ...
Carlo Antonelli's user avatar
0 votes
2 answers
4k views

How do I add $_SESSION[''] to my wordpress page?

I am trying to take my existing object array then json_encode it and add it to a $_SESSION[''] so I can request it on other pages on my website. Is there a way to save my session string (or array) and ...
davidb3rn's user avatar
0 votes
1 answer
2k views

keep a variable for all pages in memory from the url

I downloaded a referrer plugin and it works fine I create my custom link and everything is fine: https://testsite.com/?r=ty5x I have a conversion system that tells me how many users have come to my ...
user14055335's user avatar
0 votes
0 answers
167 views

PHP session not staying alive. headers already sent

I'm having trouble keeping my session alive, it times out after 3 hours (our desired custom timeframe) regardless of user activity. It used to keep the session alive for the next 3 hours every time ...
Eugene's user avatar
  • 1
1 vote
2 answers
9k views

$_SESSION variable not saving on page refresh or new page

So I have a form that allows the user to select a city. Once selected, this city is then saved to a $_SESSION variable as such : $_SESSION['city_selected'] = $_POST['location_select']; This works fine ...
Charlie C's user avatar
0 votes
1 answer
771 views

Requiring a Visitor to Enter a Password Each Time They visit a Page

the pandemic has changed my role within my company so that I'm now doing all of our WordPress development, despite having zero training with WordPress. Feel free to include any comments about my boss'...
Adam Nelson's user avatar
0 votes
0 answers
166 views

Login issue with subdomain installs

I have two Wordpress instances, both of them have multi-site setups. The issue is: the two instances do not seem to work together in terms of login. I sometimes can't login to the second instance ...
gerky's user avatar
  • 101
0 votes
1 answer
470 views

after logout session not destroy from server/website side

I have a wordpress site , when i logout from client side , then session is still exists while it should be destroy. yet it is exists in site. while i cleared browser session and cookies yet it exixts.
Nitesh Kumar's user avatar
4 votes
1 answer
515 views

Does using set_transient() function can lead to MySQL problems?

As a plugin author, I have to think about many things. One of my plugins uses a temporarily PHP session to save the JSON data that receives through its API in array type. Because PHP session has its ...
Ivijan Stefan Stipić's user avatar
1 vote
0 answers
82 views

Wordpress Keeps Logging Out - What Tests Can I Run to Solve This?

I keep getting logged out of wordpress randomly. Despite having set long "Remember Me" times etc. I am still being required to log back in when I re-open my browser and whilst in admin, I randomly get ...
Bruce Banner's user avatar
1 vote
0 answers
67 views

User Session and Stored Cookies not get removed

I am using below code to remove the user session, cookies etc, but its not working. Please help me to resolve this issues $userid = get_current_user_id(); //get current user id sleep(30); //to ...
Amar Verma's user avatar
0 votes
0 answers
181 views

wordpress login loop and session problem

I have a login problem in the Wordpress Admin panel. First I have the redirect loop wp-admin to wp-login with the param reauth=1. I tried all the suggestions found in the support forums but none of ...
Jihane's user avatar
  • 1
0 votes
0 answers
194 views

Get WordPress logged in username from root domain when WP is installed in a subfolder

Here is my URL structure: http://www.example.com/homepage.php http://www.example.com/wordpress/ Wordpress is installed in a subfolder but I need to get the cookie in homepage.php to check if the ...
456543646346's user avatar
0 votes
1 answer
2k views

$_SESSION variables work perfectly on my local machine but returns NULL on development webserver

I'm using a hook into init where I add a certain timestamp in order to include a splash screen into within my Wordpress project. Basic logics of the script is: add_action("init", "my_function", 1) ...
Jim's user avatar
  • 160
0 votes
0 answers
45 views

Sessions with WordPress

I am implementing custom user registration system for website clients, so that they can edit their information. But I have read a lot that WordPress do not support session. For example, https://...
Mohammad Umar's user avatar
0 votes
1 answer
292 views

Updating transient value frequently

Is it alright conceptually to update transient value frequently. I am building up a login form & every time user enters invalid credentials, store the incorrect attempts. So I am using user IP ...
wordpress user's user avatar
1 vote
1 answer
622 views

How to expire session after 2 hours and also expire when browser closed?

I want to expire session after 2 hours and also want to expire session when browser closed add_filter('auth_cookie_expiration', 'my_expiration_filter', 99, 3); function my_expiration_filter($seconds, ...
Sudhir's user avatar
  • 113
0 votes
1 answer
1k views

Best hook for when a user session ends?

I'm creating a backend feature that calculated user's login sessions during the past 2 weeks. This is easy enough to do by incrementing a custom user field when the user logs in using wp_login: ...
Best Dev Tutorials's user avatar

1
2 3 4 5