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.

135 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
1k views

Setting Cookie Using a Variable from the URL

I need to hand code an affiliate link (we do not want to use an existing plugin). I do not do a lot of coding, so bear with me. It seems so simple I have a link: http://www.domain.com/?code=8765 ...
4
votes
1answer
547 views

Display message once per session to users with a specific role

I need to display a message to only users with a specific role. The message should appear either as soon as the user logs in or if they re-open their browser after having closed it when logged in to ...
3
votes
0answers
5k views

How to fix samesite attribute in wordpress for chrome errors?

I have several wordpress sites that run on a rhel7 box that I admin. All of the sites use a custom SSO plugin that I wrote. Today I was told that other sites were having issues accessing one of ...
3
votes
1answer
1k 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: ...
3
votes
1answer
2k views

How to resolve error “Cookies are blocked due to unexpected output.”?

I am facing an error as per below at admin panel login. "ERROR: Cookies are blocked due to unexpected output." I've tried several solutions like, Log checking (No logs are showing in log file) ...
2
votes
1answer
118 views

Popup Cookie Wordpress select language and section (Elementor)

I need to show a popup where the user can choose the language and which section to open (partners, customers, support) and that this choice is kept in the cookies so that the next time he returns that ...
2
votes
1answer
135 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. ...
2
votes
1answer
63 views

Logins through alias

My site is hosted by a university that runs all external traffic through an alias. The actual URL of the server is accessible only on campus. Right now I have the site address set to the alias and the ...
1
vote
0answers
17 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 ...
1
vote
0answers
26 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 ...
1
vote
1answer
39 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. ...
1
vote
0answers
124 views

Block google maps from loading until user agrees to cookies with Elementor

So im in the middle of doing my privacy policy with my lawyer and he has mentioned that one of the more important things to be GDPR compliant is that if a user denies cookies from being allowed (...
1
vote
0answers
28 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
14 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 ...
1
vote
0answers
124 views

Where does the cookie mo_page_views_counter come from?

mo_page_views_counter: 3 mo_has_visited: true mo_is_new: true I have the following cookies set on my wordpress site... However I do not set these cookies and I have turned off all plugins that might ...
1
vote
2answers
59 views

WordPress Light/Dark Theme best practices? Is there a way that really works?

We currently have a light/dark theme enabled on our WordPress site using cookies and a .dark class in CSS. It works, but makes using WP Total Cache almost not worth it as any post/page using the ...
1
vote
0answers
225 views

Cookie signed verification failed - wp-saving-post

I'm setting a WordPress, but posts can't be saved. A 500 error shows up. I contacted the system's team, and apparently it's because they have a Firewall (Fortiweb), and one of the rules is about ...
1
vote
0answers
501 views

Enable Wordpress to share cookies between domain.com and sub.domain.com

I have a Wordpress core install on domain.com and am building a JavaScript web application, without Wordpress, on sub.domain.com. I'd like to see whether or not the user has logged into domain.com, to ...
1
vote
0answers
30 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....
1
vote
0answers
154 views

How to do persistent data on Front End?

I´m doing a plugin with a member system. I need to : display notices ( error, warning, info ) for visitors when they fill the form to subscribe. To match with my core project, I need a system with a ...
1
vote
0answers
40 views

how can i use $_COOKIE[] + PostID to execute the below code?

someone can teach me how to combine $_COOKIE[] + PostID to count one visit by ip + post? I want use this to not use set_transient, my actual code is this: if( !current_user_can('administrator') ) { ...
1
vote
0answers
51 views

How I can share cookies from my dimain to subdomain?

I have one web site like hello.com, and another world.hello.com for example. world.hello.com is not a WordPress but need sharing cookie to know if user is logged in or not. How I can share in all ...
1
vote
0answers
418 views

How to setup cookie free domain for wp-includes?

I setup a cookie free domain and pointed the wp-content folder to it in config added define("WP_CONTENT_URL", "https://static.domainname.com"); define("COOKIE_DOMAIN", "www.domainname.com"); all ...
1
vote
0answers
176 views

Wordpress authentication cookie and ajax calls

I'm up against a challenge. I got a WordPress website where users sign up to the website using the built-in WordPress user login system. And as you may know, this places a WordPress authentication ...
1
vote
1answer
1k views

After logout browser's back button into twenty sixteen theme profile

I have tried numerous ways to prevent the browser's back button from allowing someone from using it to go back into a visitors logged out profile. The codes I used were supposed to prevent the browser ...
1
vote
0answers
25 views

COOKIE_ID with username appended

Good evening, could you tell me how I can add to the cookie name of the user logged in wp in this code? COOKIE_ID = const 'mnp_'; I wish the result was like "mnp_Antony" Thanks for the help
1
vote
0answers
774 views

Delete cookie when changing url (when navigating away from specific page of website)

I am working on a wordpress website with woocommerce. In my cart.php I defined a javascript cookie as I want to store some choices that a user does on this specific page. The code is jQuery(...
1
vote
0answers
1k 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-...
1
vote
0answers
610 views

Setting Cookies For Form Autofill

I'm trying to set cookies on a gravity form submission to collect and store information submitted on one form and fill in the information on another form as well as filling out the original form again ...
1
vote
0answers
187 views

Redefine cookie domain for subdomains

I have done all the research on this question but none of it is working. I have an application consisting of a WordPress site at "domain.com", and a CakePHP/Angular application at "sub.domain.com". ...
1
vote
0answers
185 views

How can I set cookies on both secure and non-secure origins at the same time?

I have a front-end login process via admin-ajax.php. It's a standard user/pass form so I submit the POST request to a secure, https, endpoint regardless of whether the user is currently on a secure ...
1
vote
1answer
232 views

What are your thoughts on overriding the PHP builtin setcookie() function to control whether or not WP creates cookies

This is a long post: This is regarding the UK, UE, and Italian cookie laws. Even though My sites are hosting in the USA I reside in the USA My sites are not commercial sites None of my sites, ...
1
vote
0answers
42 views

Session Expired when WordPress Address (URL) and Site Address (URL) are different

I followed this article to allow me to put our company's WordPress blog on a subdirectory of our Heroku hosted site: http://nicolasmlv.com/wordpress-in-your-rails-app/ This says to add this code to ...
1
vote
0answers
904 views

Cookie Domain is preventing Admin login

I just defined a Cookie Domain in my wp-config.php: define( 'COOKIE_DOMAIN', 'http://www.example.com' ); define( 'WP_HOME', 'http://www.example.com' ); define( 'WP_SITEURL', 'http://www....
1
vote
1answer
1k views

Login problems on multisite installation with different domains

I have a subdomain multisite installation in site.com, with subsites such as sub1.site.com, sub2.site.com etc. I needed to transfer one of these sites to an own domain, sub1.com. So I changed the ...
1
vote
0answers
1k views

How to handle cookies from a WordPress plugin on a cached page?

I'm attempting to write a plugin that can work with cookies on a WordPress site that uses page caching (why?). I've been following this tutorial on Esanctuary.net. I'm trying to write to the ...
1
vote
1answer
421 views

WP not logging in at first time

I've been experiencing a weird "bug" in my website which I have a form in the front page to do the log in, it doesn't log, redirects me to the WP-login.php and it says the Cookies may not be active in ...
1
vote
0answers
547 views

Login cookies set as wrong domain

I'm building a plugin that allows oauth2 logins from providers (eg google). My code is setting the wordpress_logged_in_{$hash} cookie domain as /wp-admin, for some reason, whereas using the normal ...
0
votes
0answers
10 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
19 views

Wordpress Multisite Single Login

I have a WordPress multisite setup with 40+ sites. (latest WP Version) I'm currently attempting to allow users to login to just one site through their account and be logged into all their accounts ...
0
votes
0answers
12 views

Error message when I'm on the login page with wordpress: cookies blocked

When I'm on the Login page in production, I've the cookies blocked error. Screencapture: https://www.pythonthree.com/wp-content/uploads/2020/11/cookies-are-blocked-due-to-unexpected-output-...
0
votes
0answers
9 views

Cookie problem with mixed domain and subdomains of a multisite installation

I'm struggling with cookie configuration in wp-config.php when having a multisite hosted on a domain, and sites on others domains, and some in sub domains of other.. like this toto.com fr.toto.com ...
0
votes
0answers
19 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 ...
0
votes
2answers
38 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
0answers
13 views

WP cookie is set but php says is not set and tries to set it again

I have a script that reads a cookie, but if it is not set writes a cookie. But, although cookie is set, sometimes the script returns several 'set cookie' in logs. I can not find why. Some idea? Thanks ...
0
votes
0answers
13 views

How to create a cookie

Cannot create cookie in single.php, how can I create it? what i want to do function totalView($id){ $count = 1; $check = get_post_meta($id, 'count',true); if(!$check){ add_post_meta($id,'count',$...
0
votes
1answer
24 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....
0
votes
0answers
23 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 ...
0
votes
0answers
8 views

wp_validate_auth_cookie interfering on Woocommerce API

I'm with some strange issue. Everything about generating and validating auth_cookies is working fine, but when I validate a cookie anywhere using wp_validate_auth_cookie, the Woocommerce API doesn't ...
0
votes
0answers
27 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...