Skip to main content

Questions tagged [cookies]

An HTTP cookie is a small piece of data sent from a website and stored in the user's web browser while the user is browsing it.

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

Can't set a cookie from php

I am trying to add a cookie in my add_cookie.php file like so: <?php setcookie("TestCookie", 'epic_test', time()+3600); exit('cookie set'); But when accessing https://my-site.com/...
user9102437's user avatar
0 votes
1 answer
50 views

How to be GDPR compliant by loading plugins?

As far as I understand I need a cookie consent before loading for example a Google Analytics plugin. Loading only a script file depending on user choice would be ok, because it is simple javascript, ...
inf3rno's user avatar
  • 135
0 votes
1 answer
34 views

How can I access user information on a subdomain?

I am trying to access the WordPress user from a sub-domain (not a multi-site install), but can't get the following setup to work. The single WordPress install is on mydomain.com and I have a script on ...
Kermit's user avatar
  • 155
0 votes
0 answers
7 views

Multisite logged into one wp-admin, move to another sites wp-admin asked to login again

I have a small networks of sites setup locally, mymainsite.localhost mymainsite-variation1.localhost mymainsite-variation2.localhost I am logged into mymainsite.localhost/wp-admin and navigate to ...
sico87's user avatar
  • 209
0 votes
1 answer
19 views

Cookie question

Question: I have a website where the homepage exists out of 2 options to choose from: Option 1: Familie Option 2: Buiten seizoen When a user clicks on one of the choices, a cookie has to be set. ...
Sander Steffen's user avatar
0 votes
1 answer
12 views

Conditional Content Linked to Cookie Value Only Shows on 2nd Page Load

I have the following 2 functions in functions.php // Function to set the plan cookie function set_plan_cookie() { if (isset($_GET['plan'])) { $plan_value = sanitize_text_field($_GET['plan']...
Discover's user avatar
0 votes
0 answers
43 views

Allow file access only via cookie

I need to have groups of PDF files on a site that are protected by different passwords, which I have solved with WPYog Documents plugin to create individual document repositories and Passster plugin ...
Pavel's user avatar
  • 1
1 vote
0 answers
39 views

Appropriate WP hook to use set PHP cookie

I'm trying to set cookie in init hook. add_action( 'init', 'sa_maybe_set_cookie' ); function sa_maybe_set_cookie() { if ( ! empty( get_option( 'sa_allow_cookie' ) ) { setcookie( 'sa-...
micky's user avatar
  • 113
0 votes
2 answers
91 views

Platform sh site setup in localhost gets Cookie error

I have setup up a WordPress project from Platform sh in my local host. I get get the project by using the platform get [id] command. I Imported the database in my localhost and configured the wp-...
tek bhatt's user avatar
0 votes
1 answer
818 views

How do I modify each instance of setcookie?

I have an internal WordPress site that I'm trying to embed via iFrame. Currently, I'm stuck on: Error: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress. ...
Kermit's user avatar
  • 155
0 votes
0 answers
79 views

How to set and retrieve cookies while in the loop

While inside the loop, I need to do some calculations with latitudes and longitudes to create a delivery fee based on a distance for each post. I have a couple hundred posts, but will only have about ...
Eric Wenger's user avatar
0 votes
1 answer
976 views

PHP cookie not set within AJAX call

I'm trying to set a cookie within an AJAX call after I get the response of an API. The API and AJAX call are working fine, but the cookie is not being set. I used the 'COOKIEPATH' and 'COOKIE_DOMAIN' ...
Loosie94's user avatar
  • 231
-1 votes
1 answer
532 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
1 answer
2k views

Why can't I enter the wordpress admin interface?

I accidentally changed the url of my wordpress page, which I finally managed to restore in phpmyadmin, the first page of my website works, but the second page doesn't, and I can't even log in to the ...
Svicc's user avatar
  • 1
0 votes
1 answer
57 views

Modify the third (context) parameter in a filter?

I understand that the following filter modifies the parameters of the authentication cookies, in fact I have managed to modify its value since it is the first parameter $cookie, but what I need is to ...
truemar's user avatar
1 vote
1 answer
202 views

Rest Api Wordpress

I wrote little plugin and I tried to use Rest Api of Wordpress for to communicate admin page to my rest. My problem is : failed rest_cookie_invalid_nonce, return 403 always. My ajax call : const ...
tecnico57's user avatar
0 votes
1 answer
343 views

Multiple issues with Ajax login function due to browsers and cookies

Using basic usage of ajax login wordpress, no cookie wordpress_logged_in_ are created on safari and Chrome and firefox doesn't read user when cookie "wordpress_logged_in". I have several ...
imagIne's user avatar
  • 105
0 votes
1 answer
267 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
  • 105
0 votes
2 answers
103 views

Cookie error. No possibility to define my cookie

I'm looking to set a cookie for one of my WordPress applications. Despite my research, I can't find why WordPress ignores the creation of the cookie. Here is my code place in my app. What do you think ...
Geo's user avatar
  • 1
1 vote
0 answers
31 views

Modifying request $_COOKIE

I have setup some conditional logic within a WP theme to display certain sections based a cookie value. I am trying now add some logic to override that cookie value in the request itself, based on a ...
mike_temby's user avatar
0 votes
1 answer
51 views

Cookies set by a plugin in wordpress for tracking

We have our companies website on a wordpress-multisite-installation with some plugins: All-in-One WP Migration All-in-One WP Migration Multisite Extension Better Search Replace HTTP2 push content ...
Zehke's user avatar
  • 1
1 vote
0 answers
106 views

How to combine wordpress_logged_in cookies in one cookie?

I'm trying to optimize my server to consume less resources as possible and increase overall performance. In my site I don't see a need to recompute same requests for users or guests every time. The ...
AtomX's user avatar
  • 109
0 votes
1 answer
261 views

setcookie on WordPress Page Template

I am having an issue with setcookie. I need to set a cookie on a page action (form). I have tried on the template file, but not working. then find out if I set it from functions.php with init hook, it'...
Sarequl Basar's user avatar
0 votes
1 answer
30 views

How can I create network with different domains?

I have heard similar questions posed but not exactly what I am looking for. Is it possible to create a multisite with different domains and sub.doamins? For example, can I create a network that allows ...
John Crockett's user avatar
2 votes
0 answers
622 views

Log in user using Wordpress REST API

I am having problems authenticating a user after logging in using a custom endpoint using the WordPress REST API. I'm aware that this is not the perfect approach but I am just trying to make a few ...
Courtney's user avatar
  • 163
1 vote
1 answer
171 views

Why wordpress cookies name contains HASH

As documented here, wordpress cookies name have HASH part. I wonder to know what is its use-case?
Mohammad Ali Akbari's user avatar
0 votes
1 answer
47 views

Favicon not loading until cookies are accepted?

I'm seeing a weird issue where my site's favicon is not loaded until I accept cookies on a cookie plugin. I wrote the plugin and as far as I know there is no tie of a favicon to cookies and the ...
Hunter Nelson's user avatar
0 votes
0 answers
75 views

How to verify which WordPress user requested the API in ASP .NET Core?

I have a use-case where I have a WordPress site and an ASP .NET Core as a Restful API backend. I use the WordPress site entire for Frontend, CMS, and User Authentication. On certain pages of my ...
user2672399's user avatar
1 vote
1 answer
126 views

Sharing a logged in session with a custom subdmain site?

I'm trying to share a Wordpress login between a typical Wordpress installation and a secondary (custom/PHP) site that will be on a subdomain of the Wordpress site. A user should be able to register on ...
Thumbs's user avatar
  • 11
0 votes
0 answers
793 views

Fatal error login Wordpress [duplicate]

When I want to login to my wordpress this appears: Fatal error: Uncaught ValueError: setcookie(): "path" option cannot contain ",", ";", " ", "\t", &...
Joshua Mart's user avatar
0 votes
0 answers
158 views

Setup cookie on Chrome even without HTTPS

I need to setup a cookie, however Chrome lately seems to accept them only through HTTPS. The "setcookie" function I use works everywhere except Chrome. If I move to HTTPS, it results as ...
a-coder's user avatar
  • 400
0 votes
0 answers
213 views

Change auth_cookie_expiration for specific roles and specific login times

In my db i have a login counter that keeps a number value as a record (1,2,3,4,5...)every time a user from a specific role logins. I am trying to change the auth_cookie_expiration to 1 day for ...
Honoluluman's user avatar
0 votes
0 answers
85 views

PHP cookie control does not work correctly

I created a custom cookie banner for my WordPress site and it works perfectly. However, now I have a small problem. With PHP I'm trying to make it invisible to users who have already accepted it. To ...
Matteo Feduzi's user avatar
0 votes
0 answers
550 views

How can I get an updated cookie in header.php?

I have trouble with getting an updated cookie. For example, I create a cookie like this in functions.php: function set_menu_id_cookie() { setcookie('menu_id', 1000, 2147483647, "/"); } ...
Roland's user avatar
  • 101
0 votes
2 answers
2k views

Setting a Custom Cookie in WordPress only for Logged In Customer/User (non-admin)

I want to create a custom cookie with custom name only for customers who have once logged in. It should be created after they successfully logged in. It should be deleted after they logged out ...
baazigar's user avatar
0 votes
1 answer
619 views

Cookie value changes back to previous value after changing

I have this custom pligin that im using in order to save the user's language preferences. I store it as a cookie like so: <?php add_filter( 'init', 'aws_set_language_cookie', 999 ); ...
user206592's user avatar
2 votes
1 answer
2k views

What is cookie "U" from domain ".adsymptotic.com" found on the WordPress page? [closed]

On a landing page of our WordPress site, I find a cookie "U" from domain ".adsymptotic.com" as the image below shows. Could you please let me know where this comes from because ...
CodeForGood's user avatar
1 vote
0 answers
1k views

When is the wp-settings-[time] cookie generated?

I created a custom plugin for login and registration forms. When I log in for a new user, 4 cookies are set : PHPSESSID, wordpress_test_cookie, wordpress_logged_in_, and 2 wordpress_sec_ . But I don't ...
imagIne's user avatar
  • 105
0 votes
1 answer
1k 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
  • 111
1 vote
2 answers
1k 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
0 answers
791 views

How to save generated JWT token to cookies on login?

I'm developing a Chrome extension and I want my users to authenticate via my WP login page. I configured JWT Authentication for WP Rest API. I want the users to go to my website, login, and then have ...
amiregelz's user avatar
  • 111
1 vote
0 answers
38 views

v5.6.2 User cannot stay logged in - wordpress_test cookie placed but not auth cookies

Running WordPress v5.6.2 with a simple Members Only function checking is_user_logged_in() and running auth_redirect() - which has worked fine up to now. Pushed upgrade to 5.6.2 and now any browser ...
George's user avatar
  • 11
0 votes
1 answer
913 views

Why set cookie from URL parameter doesnt work all the time?

I use only "pages" from my WP installation (not posts) and I want to set a cookie based on the existence of a GET parameter in the URL. I have put the following code in the top of my page....
NewGuy's user avatar
  • 1
0 votes
0 answers
340 views

Authentication between two different sites using the WordPress login cookie

Two different WordPress, two different users, same account and password. In this case, if the user wants to go to (A -> B) the B site after logging in to the A site, the session HASH is already ...
Pelmi's user avatar
  • 3
0 votes
0 answers
77 views

How are sites using wordpress hiding wordpress cookies that have "wp" or "wordpress" in the cookie name?

I have looked at some big sites that are running wordpress and not one mention of it in their cookies I am trying to do that with my site...
Joey's user avatar
  • 1
0 votes
0 answers
1k views

Ajax login fails: script sets cookies, but is_user_logged_in() returns false

Summary Ajax request to a back-end plugin PHP script successfully logs in the user and sets login cookies in the browser. However, the page making the call fails to recognize those cookies, and ...
nightowl's user avatar
0 votes
0 answers
123 views

Display value of the GET parameter in a new URL page

Here's what I'd like to achieve: retrieve the GET value of its parameter from http://mysite/testing/?name=302Beep store it in a cookie redirect to http://mysite/dashboard display '302Beep' in http://...
302Beep's user avatar
2 votes
1 answer
241 views

SSO autologin Wordpress + Ajax

That one keeps me awake at night. The problem is that the user is properly logging in, but AFTER page refresh and should be immediately logged in without page reload. Need a fresh eyes to look at it. ...
WP Help Cat's user avatar
0 votes
1 answer
111 views

Is it possible to use cookie-free domains in WordPress?

Is it possible to do it manually or is there any plugin? Or I must use CDN like Kinsta? (Now we use CloudFire). Thanks for any answers!
Bogdan's user avatar
  • 141
0 votes
0 answers
83 views

How to run code when cookie is added?

So I have the code below, and its purpose is to prevent the Facebook for Woocommerce plugin from running the FB pixel until the necessary consent is given. It works to solve the problem in the sense ...
Johnny Walker's user avatar

1
2 3 4 5
8