Questions tagged [session]
The session tag has no usage guidance.
200
questions
0
votes
0
answers
7
views
Keeping session alive after next tab button
So i have a contact form 7 and a booking form what i want to achieve is that, what the user input in the contact form should be pass/fetch in the booking form after the user click's submit. i already ...
0
votes
0
answers
119
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 ...
0
votes
0
answers
93
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 ...
0
votes
1
answer
45
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 ...
-1
votes
1
answer
231
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(...
0
votes
0
answers
39
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 ...
0
votes
1
answer
144
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 ...
0
votes
1
answer
327
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/...
0
votes
1
answer
66
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 ...
0
votes
1
answer
371
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 ...
0
votes
1
answer
46
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 ...
0
votes
0
answers
76
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 ...
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 ...
1
vote
1
answer
332
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 ...
0
votes
1
answer
993
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 :
...
0
votes
0
answers
60
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), ...
1
vote
0
answers
113
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 ...
0
votes
1
answer
199
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 ...
0
votes
1
answer
4k
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 ...
0
votes
0
answers
141
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() === ...
0
votes
0
answers
38
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 ...
0
votes
1
answer
702
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 ...
1
vote
2
answers
814
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']))
...
0
votes
1
answer
384
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 ...
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 ...
0
votes
0
answers
56
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 ...
0
votes
0
answers
44
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()) {
...
0
votes
1
answer
735
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; ...
0
votes
1
answer
644
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 ...
3
votes
5
answers
19k
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 ...
0
votes
0
answers
68
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-...
0
votes
0
answers
529
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 ...
0
votes
2
answers
3k
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 ...
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 ...
0
votes
0
answers
111
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 ...
1
vote
2
answers
7k
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 ...
0
votes
1
answer
340
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'...
0
votes
0
answers
151
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 ...
0
votes
1
answer
355
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.
4
votes
1
answer
463
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 ...
1
vote
0
answers
64
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 ...
1
vote
0
answers
58
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 ...
0
votes
0
answers
171
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 ...
0
votes
0
answers
170
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 ...
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)
...
0
votes
0
answers
42
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://...
0
votes
1
answer
227
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 ...
1
vote
1
answer
562
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, ...
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:
...
0
votes
0
answers
940
views
Why isn't working WooCommerce session inside shortcode?
Hope you're doing great! I am trying to print the WC()->session->get inside a shortcode but getting error , bellow is my code and error
function set_session(){
global $woocommerce;
WC()->...