Questions tagged [session]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
22 views

session start - no such file error [closed]

So I made a copy of a wordpress website to local host. All is working finally except when I go to the website and the image attached shows on top. Basically it says: Warning: session_start(): open(/...
0
votes
0answers
18 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
1answer
588 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
0answers
33 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
0answers
34 views

Wordpress Multisite One Login For All Subsites

I have a WordPress multisite setup with 40+ sites. (latest WP Version) I'm currently attempting to allow users to login to just one subsite and be logged into all other subsites across the multisite. ...
0
votes
0answers
22 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
1answer
144 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 ...
0
votes
2answers
141 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
1answer
31 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
1answer
277 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
0answers
26 views

php session not going to next page in wordpress

I have a WordPress website. As the sessions are not activated by default I did the following code in my function.php: function ur_theme_start_session() { if (!session_id()) session_start(); } ...
0
votes
0answers
33 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
0answers
21 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
1answer
39 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
0answers
20 views

Unable to fetch customer (guest user) address to calculate travel cost in Woocommerce

For Guest User I am adding a travel cost for a product so I am adding a filter callback as follows add_filter( 'woocommerce_distance_rate_shipping_calculated_distance', '...
0
votes
1answer
185 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
4answers
10k 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
0answers
27 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
0answers
311 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
2answers
726 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
1answer
698 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
0answers
27 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
1answer
2k 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
1answer
54 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
0answers
70 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
1answer
112 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
1answer
319 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
0answers
36 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
0answers
16 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
0answers
84 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
0answers
88 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
1answer
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
0answers
35 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
1answer
61 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
1answer
367 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
1answer
456 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
0answers
582 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()->...
0
votes
0answers
38 views

Trying to configure cron to get next value from array on each run

So I have this block of code and it is driving me crazy: if ( ! wp_next_scheduled( 'change_quote_hook_short' ) ) { wp_schedule_event( time(), 'one_minute', 'change_quote_hook_short' ); } ...
1
vote
1answer
81 views

Session Experies and Get Logged Out Within Few Minutes

I have wordpress simple blog with few plugins installed. My problem is that after logging and working for few minutes (hardly 2-5 minutes), session expires and I get logged out of the admin area. ...
3
votes
1answer
2k views

Handling nonces for actions from guests to logged-in users

Imagine the following scenario: John has an account on my website, but is currently not logged in. He clicks the "upvote" button on an article, but is redirected to the login page because only logged-...
0
votes
1answer
164 views

Pass Wordpress variable to the next page

I would like to pass a category name into the next page. I'm using Session. In functions.php I added: function session_initialize() { if ( ! session_id() ) { session_start(); } } add_action( '...
-1
votes
1answer
927 views

Create a Custom Login System in WordPress [closed]

Please I need help with this. I wrote a basic code to create a login form that will validate, retrieve data and display on my dashboard but I have the following challenges: It always displays "...
1
vote
1answer
457 views

How to store post ID's in cookie or session to display the same posts later

I run a wp_query that fetches 4 posts from db with rand() and displays them in a grid to visitors. What I need is to display the exact same posts the query fetched the first time, a second time to ...
0
votes
1answer
85 views

Re-use Nonce in Repeating Event Signup Buttons

My understanding is that wordpress nonces (not exactly a "number used once") prevent cross-origin request forgery and last 12 hours. I'm displaying a schedule of classes with a registration button ...
0
votes
2answers
6k views

Unset session variable on page reload / setup but exclude AJAX

I'm currently trying to unset a session variable in WordPress if the page get's reloaded. I've tried a lot but it's not working like I want it. This is my function: /** * Unset filter session if ...
0
votes
1answer
599 views

$_SESSION inside php function executed by AJAX

I am defining $_SESSION['session_test'] from $_POST['reason'] I get from AJAX call. Inside of this function, $_SESSION['session_test'] does get defined, and I get desired echo result. add_action('...
0
votes
1answer
763 views

Front end ajax user login session issue

I am having an issue where the ajax login form allows me to login, sort of. If I set the redirect to the homepage after login it sends me to the homepage and gives me the admin bar at the top. However ...
0
votes
1answer
22 views

Use WP user status (logged_in) to manage access to independent application

I have WP installed in the root of my website. In the same directory there’s a completely independent application. What I want to do is the following: when the user accesses the page containing the ...
0
votes
1answer
254 views

ajax polling with admin-ajax.php

Is it possible to do ajax polling in WordPress with admin-ajax.php for example every 300ms? I have tried this and it appears that doing the ajax request with admin-ajax takes longer than the ...
1
vote
0answers
31 views

Check if user is logged in to site A when visiting site B

I have two separate WP installs. The main site (a.com) and the blog for that site, which is on a subdomain (blog.a.com). I need to be able to check if a user visiting blog.a.com is logged in to a.com....