Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

The tag has no usage guidance.

0
votes
0answers
11 views

session start for each page loaded

For my plugin, I would like to use $_SESSION in the admin part. Thanks tutorials, I understood that Wordpress has got a behaviour to remove some global variables and the best way is to use a hook to ...
1
vote
0answers
22 views

Expired session error (admin) when I try to make a call to WooCommerce api [closed]

I have activated the WooCommerce API that is mounted on the WP, the administrator session expires every 2 hours, the problem is that when I try to make a call to the WooCommerce API, it returns a 200 ...
0
votes
1answer
19 views

how to remember specific action/event for current user?

i have made multi-language site thanks to polylang now i dont want to use polylang's switcher as it causes layout issues so i found a better solution is by putting a link on top. for example if user ...
0
votes
1answer
14 views

Safe to start a php session on get_header action?

I now usually php sessions are started from the init hook, but get_header runs before writing the page, sono technically speaking, I can open a session from there. Is there any other reason I should ...
0
votes
0answers
11 views

Session user and php conditionalqsd

I am in a multi site environment on Wordpress. I need to know the identification name used to display a specific message. Where can I do this in php or otherwise like this: if ($ user1) { echo "...
0
votes
1answer
24 views

How to destroy all user sessions via WP-CLI

In installed WP-CLI v1.5.0 I ran wp --info and it return the correct info. I then ran wp user session destroy user1 --all and got this: CORRECT>w user session destroy prvweb -all (y|n|e|a)? ...
0
votes
0answers
36 views

login to all subdomains by login in one subdomain wordpress multisite

I have installed a wordpress multisite with subdomains, it has installe d properly and working fine, Now I want to share users among the subdomains so that users are not needed to register for every ...
2
votes
1answer
96 views

Find out what is using PHP sessions in WordPress

Is there a way to find out what is using PHP sessions or spawning PHP processes? My Wordpress site gets heavy traffic (3.5 million hits per month). We discovered recently that we had permissions set ...
3
votes
1answer
498 views

How to log out everywhere else, destroy all sessions “all other devices”?

WordPress panel service "log out everywhere else" is doing a nice job. I want to use this as a function outside the panel. Screenshoot
1
vote
0answers
49 views

Share WordPress login info with other PHP app

A customer asked for this feature: website with WordPress website with PHP app where is a login form Request is: "when i login info WordPress I've to be able to share login data with the PHP app so ...
0
votes
0answers
31 views

Refreshing asp.net in Wordpress plugin iframe lost login credential (usename and password)

Our company started to use Wordpress this year. I have used ASP.net, and am new to Wordpress. In order to run ASP.net page, we installed a plugin and use this code. [iframe src="abc.com/wp_login....
1
vote
0answers
61 views

Logout USER form backoffice after 30 minutes of inactivity [closed]

I looking for to logout user from backoffice after 30 minutes of non activity except Administrator role. Thanks.
5
votes
1answer
186 views

WordPress and PHP Sessions - Security and Performance

I'm writing a WordPress plugin to deal with a third-party API. This API requires a session identifier be passed to it so that the API (which basically functions as a third-party cart) knows what ...
0
votes
0answers
27 views

Dropdown set session or cookie variable

I'm using a Wordpress theme that I built with some pages where there are some dropdowns (select) to choose a State of interest, then with ajax it loads some information related to the selected State. ...
0
votes
0answers
20 views

How can I provide the user id to a javascript snippet

A client wants to add their own "feedback" tab to a WordPress site I run for them (the type that adds a floating blue tab to the edge of the page), and they need to capture the user ID when the script ...
0
votes
0answers
109 views

Keep user session with different domains

Sorry for my english, I'll try to explain my problem simplely. I've installed a wp multisite in local with 2 sites (for now) : - main.fr - second.com I wish that a user can log on from the front ...
0
votes
1answer
373 views

Change the default 10-day expiration for the password protected pages cookie

I'm trying to change the default 10-day expiration for the cookie that allows a user to repeatedly view the content on a password-protected WP page without having to re-enter the page password during ...
0
votes
0answers
424 views

Changing the WP login session cookie time?

As i know, WordPress makes login session cookie expire in 48 hours or on browser close. And in 14 days, if we check the "Remember Me". I want to change this time to 5 seconds: function ...
0
votes
1answer
215 views

how do i change my website facebook login button to another text immediately user login? [closed]

i added a facebook login button to my website, this facebook button work well but even if a user is logged in, the facebook login still shows i need detail help or tutorial link that can help me ...
1
vote
0answers
176 views

Session destroyed on page redirect

I am developing a plugin where I have started a session on init hook. I have a form which when submit calls a function which uses SDK (i.e payment is handled here). If this function returns FALSE ...
0
votes
0answers
36 views

session_start() in my custom plugin catch error 500 when WP Super Cache is installed

I'm a fan of WP Super Cache plugin and I use it on every site that we develop. But... I did develop a plugin that use SESSION. After some hour of debug, I did discover error 500 with this fragment of ...
0
votes
1answer
277 views

How to get session token of current user in wp_login hook?

I want to get current user's session token in the hook - wp_login. I have tried this code in functions.php: add_action('wp_login','test'); function test() { var_dump(wp_get_session_token()); //...
0
votes
0answers
169 views

$_SESSION variables lost during OAuth callback

When I attempt an OAuth handshake, the first step is a GET call to obtain an access code like so. # Redirect to request authorization code $url = $this->get_authorization_url(); header("Location: ...
0
votes
0answers
42 views

Error trying to access admin session in wordpress

My site is working normally, but when I go to the admin session it starts to appear this error, until day 29 was working normally, I stayed these days without entering. The error presented below ...
0
votes
2answers
179 views

update_user_meta() does not work

I asked a question yesterday, but I realised that the code was not correct and it was my bad, so I refactored everything. I have a form with two fields which when user submits and takes a quiz test, ...
0
votes
0answers
18 views

$_SESSION Not working after X amount of page views

I've written up a simple function that's output into header.php, which displays the login/register modal upon so many views in this case I've set it at 4, however its firing on the first view of my ...
0
votes
0answers
101 views

$wpdb->update is not updating a field in the databse

I have a database table with one field with default value 0. Every time a user register, this field needs to be updated with the user's id from another table. The id values of the user and the row ...
0
votes
0answers
33 views

Best way to clean session at logout

I am looking for the best way to clean the user session when logout. I made a function that is called when user click on logout that contains session_destroy() and returns wp_logout_url But what if ...
0
votes
0answers
70 views

Check If Password Protection Cookie Exists

I've got a site with private content on it that I want to require a password in order to be able to view. I've enabled the password protection on the posts I want blocked and customized the login page ...
0
votes
1answer
218 views

The session works on the local server, but not on the web server

I have a problem with a session, it works fine on the local server, but it's not visible on the server, the project is in wordpress, do I have to set something special about wordpress? This is my code ...
0
votes
0answers
84 views

Wp_session not working with firefox and edge

I am using wp_session plugin to store instagram access token in the session variable to check if it is set then show the page. In case of chrome everything works fine. But in firefox and edge the ...
1
vote
1answer
58 views

Large Session Tokens

We have a Wordpress site on a shared server that recently crashed due to running out of disk space, because our MySQL binary logs filled up the drive in a matter of minutes. After reviewing what was ...
0
votes
0answers
666 views

Share user session between main domain and subdomains in the same server

I need to share the user session between the main domain (the WP installation) and many subdomains (wildcard). In the subdomains, wordpress doesn't exist, only a index.php which loads the wp ...
0
votes
0answers
27 views

Session constantly resets variable

I'm using sessions in wordpress but I have a problem where a variable I store keeps getting reset everytime I change page. it's "d_curr" and my code is the following : add_action('init', '...
0
votes
0answers
216 views

How do I get the user session variable of login current logged in user

How do I get the session variable of login in wordpress? The thing is, to get the id of the current user who logged in. If we login in Wordpress there is session that keep us from logging in. I want ...
0
votes
0answers
241 views

How to use wordpress generated session in codeigniter

I followed this and installed this plugin. And in active template footer.php I did this: $session=WP_Session::get_instance(); $session['user_contact'] = array( 'email' => 'user@name.com' ); ...
0
votes
2answers
368 views

PHP Session Variable to WordPress Error

I have been trying to figure out how to add session variables to WordPress Custom Pages for the past few days but have still been unable to find a solution. From researching it seems WordPress does ...
0
votes
0answers
30 views

Alternative post password?

Use Case: I have users that have created a password protected post for each product they sell. Instead of asking for a generic password or an entire serial number, we would like to ask the customer ...
0
votes
1answer
90 views

how to show posts of category random by session

Currently my homepage posts shows as random and arranged by visitor session but in category it arranged by last added, I want to arrange posts random in category similar to homepage function ...
0
votes
1answer
74 views

Looking to load a different template part on every load/refresh

I basically have a site where I have several different template headers that I want to load via get_template_part. The basic idea is when someone first visits the site, they should see a random ...
0
votes
2answers
39 views

Add class when more page is visited

I would like to add a CSS class to the body if a visitor goes to the second or third etc. page of the website. Or vice-versa: add a class only on the first visited page. The goal is that I can ...
0
votes
1answer
98 views

How Can I Move Data From Form 1 To Form 2

I have a 2 step website registration for my WordPress website. BEGIN EDIT The first step/form is a front end verification form plugin I have built that checks a custom_table to verify the visitor is ...
3
votes
0answers
62 views

Random popup image per user with no repeat

I am pulling images from an ACF gallery that resides on another page. What I intend to do with this is to have these images displaying full screen on my home page on a popup every time the page loads. ...
1
vote
2answers
459 views

How can I get logged in user's session data from admin-ajax?

I have hooked an ajax call for a logged-in user, and now I need to catch his data inside the receiving call (the code that receives the action call). How can I get the user's ID reliably? This code is ...
0
votes
1answer
455 views

Allow user to select location and then set cookie for location in WordPress

I am needing to allow a user to select a location from a dropdown on the front-end, that then sets a session cookie for that chosen location... any help here? Ok so this is the outlined task: ...
0
votes
1answer
21 views

Capture and display users name

Can anyone tel me if a plug-in exists that can do the following: Check is it's the users first visit, if so the user will be prompted to input their first name into a text field. Their name will then ...
0
votes
0answers
144 views

Woocommerce cart is a non-object inside `admin_post` action

I'm writing a custom integration plugin for Woocommerce, to add a dynamic product to the cart. Right now, without the plugin, I make POST request via a form inside an external page containing the ...
1
vote
0answers
175 views

iframe does not store session/cookie when refresh parent

I have been searching around but there was no specific answer or any indication about the problem I am facing. I have a domain, parent.com, which is just a full screen container of a WordPress-...
0
votes
0answers
34 views

Is it possible to have two different users with different roles logged in simultaneously using the same browser

I couldn't fit everything in the question so here are more details : What I want to know basically is if it is possible for someone to be logged-in on the front-end (ie web application) and ...
0
votes
1answer
282 views

Custom $_SESSION expires too early

In my custom Wordpress theme I want to keep some user's data stored over time (let's say 5 days) using $_SESSION variable. At a certain point in my theme I do a very simple thing: session_start(); $...