Questions tagged [session]
The session tag has no usage guidance.
201
questions
0
votes
1
answer
13
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
0
answers
12
views
Codeless random token generation to pass into multiple tracking links in a single page load
In domain my-nice-company.com (my WordPress) I want to include traking transparent images to some-tracker.org/1x1-transparent.png and some-other-tracker.info/track/pixel.jpg
I want to pass-in a ...
0
votes
1
answer
22
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
21
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
0
answers
15
views
Strange admin-ajax / CSS / $_SESSION issue
TLDR: I'm generating a random token on a front-end form and storing it in $_SESSION to later retrieve by the ajax script.
THE ISSUE: The code retrieved by the ajax script does not match the one ...
0
votes
1
answer
35
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
41
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
25
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 ...
0
votes
0
answers
29
views
Form Post / Session Variables not Working in Query with Pagination
I am developing a custom search where the user inputs data on the first page with a form. Upon clicking submit, the user is brought to a second page for the results. I pass the data via pulling in the ...
1
vote
1
answer
37
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
160
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
72
views
Set cookie parameters on wp site - PHP not working?
I've developed quite some wordpress plugins which use a user system incl. login, logout etc. features using PHP's $_SESSION superglobal.
Now I'm stuck in a project where the client does some sensitive ...
0
votes
0
answers
34
views
logout users with specific role after close browser tab
I'm looking for a way to logout a specific user role (external_user) when he closes the tab/window of a web browser.
How can i proceed to close the session?
Thanks.
0
votes
0
answers
18
views
Session management issues with WordPRess 404 Error page
I have tried to integrate wordpress into my existing website as the documentation archive using the existing login session. I have installed wordpress under /wp of the root app.
In my main app, I set ...
0
votes
0
answers
43
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
23
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
69
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
0
answers
23
views
Are there any drawbacks on opening a session_start in functions.php and header.php?
Are there any drawbacks on opening a session_start in functions.php and header.php?
Especially from a speed / loading speed/time and resource perspective?
Anybody?
Happy to learn about this!
0
votes
0
answers
22
views
Navigation Switcher functionality with button ( not language switcher )
I have a WordPress site that has a switcher button that needs to switch navigation between regular and expert visitors.
I want the regular visitors not to see some navigation items. As both, the ...
0
votes
1
answer
2k
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
66
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
32
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
415
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
366
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
78
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
474
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
40
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
25
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
177
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
335
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 ...
2
votes
4
answers
14k
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
40
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
379
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
2k
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
995
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
37
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 ...
0
votes
1
answer
4k
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
98
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
108
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
203
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
373
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
46
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
31
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
128
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
137
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
1k
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
38
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
120
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
430
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
713
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:
...