Stack Exchange Network

Stack Exchange network consists of 175 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

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.

0
votes
1answer
15 views

Cookies from JS to PHP [on hold]

So I am trying to store some cookies from JS and then use them in a function from PHP. This is the code for setting cookies: function setCookie(name, value, hours) { var expires = ""; if (hours) {...
1
vote
1answer
25 views

Auth cookie value security risk?

A short question this time: How much of a security risk is it when an third party gets access to WordPress auth cookie? Can they for example simply copy the cookie and "be" logged in as the user who ...
0
votes
0answers
8 views

cookieless subdomain err 500 and 404

I'm trying to use a subdomain for my statics data (images, js, css, themes..) I create a subdomain as CNAME : static.mywebsite.fr I added the lines in wp-config: define('COOKIE_DOMAIN', 'www....
0
votes
0answers
23 views

Easy way to check auth_cookie_expiration setting in browser dev tools?

I'm trying to change the auth_cookie_expiration setting in my functions.php file in order to limit all logins to 2 hours. I've done the basic hook for this: function expire_in_120_minutes() { ...
0
votes
0answers
7 views

can i set cookie by assign?

Mistakenly i created a cookie by assigning it to value e.g. $_COOKIE['limit_reached'] = 'reached' then i tested my code that depends on it and it worked, then i figured out that this isn't how we set ...
1
vote
1answer
19 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
2answers
36 views

Setting Cookie with init hook causes 'header already sent'

Based on research here and elsewhere, I have the following code that sets a cookie on a site: add_action( 'init', 'my_set_cookie',1 ); function my_set_cookie() { if (! $_COOKIE['mycookie']) { ...
0
votes
1answer
28 views

Getting an ERROR: Cookies are blocked error when logging in to a site on a different domain?

I am getting the following error: ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress. When trying to login to a network site on a different ...
1
vote
0answers
14 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 ...
0
votes
0answers
71 views

Calling wp-login.php?action=postpass not setting cookie

I'm trying to set the wp-postpass cookie via my front end homepage written with vuejs. Relevant code below: submitForm() { console.log(this.password) axios .post('https://mywebsite.com/wp-...
0
votes
0answers
18 views

How can i get counter of all new post published using cookie

I'm trying to make it work, I found this snippet here on stackoverflow, and it working very well, I did some changes to build an drop down notifications box with bell icon as shown in the picture ...
0
votes
0answers
29 views

How are cookie values encoded?

Title kind of says it all. I can easily generate the md5 hash for the key, but I noticed in my devtools that the value is also encoded somehow. I tried setting it to the plain-text value, but this isn'...
0
votes
1answer
17 views

Cookie only detected when visitor is logged in

This is my first time playing around with cookies, so i apologize if the question is "stupid", but i did not manage to find an answer anywhere else on this site. Iv'e set a cookie using this code in ...
0
votes
1answer
13 views

What could cause a staging environment to not send wordpress_logged_in cookies?

We have a custom login and account creation plugin. It works fine on our live environment (example.com) but not on our staging environment (test.example.com). When we call wp_insert_user via an AJAX ...
0
votes
0answers
17 views

Avoid Cookie from removing old notifications

sorry peoples I'm newbie with WP, How can I avoid cookie from deleted old notifications! How can I keep all of them until expiry comes or click on hide button. I don't need to remove the old ...
0
votes
0answers
19 views

Set Cookie for New Post Published - Notifications bar

sorry i'm newbie with WP, I found this snippet on Stackoverflow, It working very well, but how can i get all new notifications of all new posts published, I don't need to remove the old notifications, ...
0
votes
2answers
36 views

Setting a cookie upon specific URL visit

I'm trying to set up, when a specific page/url is visited that a cookie is set and saved. So far I've tried this: add_action('init', 'set_cookie', 1); function set_cookie(){ if ( $currentURL == '...
0
votes
1answer
96 views

Displaying content based on drop-down menu selection sitewide

Here's the scenario: Client provides services to a wide geographical area but pricing changes based on area. I don't want to incorporate geolocation, but I do want to permit the visitor to select ...
0
votes
1answer
37 views

Wordpress cookie issue on login: “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”

recently I had the problem where on login page Wordpress reported an error: ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress. This was asked ...
-1
votes
1answer
24 views

How to resolve these findings from security audit

I am working on a corporate project and they are running security audit by consultants and they found the following issues regarding Wordpress. I managed to get a lot of issues resolved using headers ...
0
votes
1answer
16 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
72 views

Custom login method appears to ignore auth_cookie_expiration

I have a custom login form that I can display by adding [custom-login-form] to a static page. While the form does look rather different, it still submits its data via method="post" to wp_login_url() (...
0
votes
0answers
55 views

How does Woocommerce load the cookies into an AJAX request?

I'm building a plugin to allow users to use their own domain on a Woocommerce store. Everything works except for requests to ?wc-ajax=get_refreshed_fragments. On the primary domain, Woocommerce sets ...
1
vote
1answer
58 views

Trying to migrate a Wordpress Multisite with Domain Mapping

I've really gotten myself into a pickle here. So I currently have a site www.company.com which has multiple wordpress installs at company.com/site1 company.com/site2 company.com/site3 (linking ...
0
votes
1answer
47 views

How can I store user preferences in WordPress and retreive them later?

I have a WordPress website where I want to give users some options to sepcify how they want to see the site. For example, they can choose from a given set of fonts, menu color etc. I am assuming this ...
0
votes
0answers
17 views

Check if user is logged in via WP Rest API [duplicate]

I tried adding this to the response headers for the REST API to check whether or not a user is logged in: $this->send_header('is_user_logged_in', is_user_logged_in() ? true : false); It always ...
0
votes
0answers
52 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
19 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....
0
votes
0answers
13 views

Can you create a global multisite cookie that can be accessed across the network?

In a multisite install, I have a request where the client wants to store the current blog ID in a cookie and be able to read the cookie data on the main site of the network. The use cases is something ...
1
vote
2answers
74 views

Setting Cookies

I'm created two themes (light & dark) but I'm not sure how to set cookies so the theme will remain constant when the user navigates from page-to-page or comes back to the site next week. Is there ...
0
votes
0answers
18 views

New blog posts don't update on page - How to force update of cookies more frequently?

An issue I am encountering is that even after I make a new post, any user who has visited my website recently isn't able to see my updated blog posts. They only see the old posts. It is only after ...
0
votes
0answers
22 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
2answers
117 views

Change the user is logged in cookie name

I have menu items that are set to be shown/hidden depending on if the user is logged in. I would like to change the default cookie name that WP looks for to determine login status. My cookie name is ...
0
votes
0answers
25 views

Wordpress Login and Logout issue (Bitnami)

I was having problem with hostgator hosting service so I am trying to move my website to google cloud platform. I installed a wordpress website (Bitnami) and there is an issue I don't understand. ...
0
votes
0answers
32 views

block cookies from beeing set

I want to create a cookie notice where cookies should be blocked until "accept cookies" has been clicked. How can I block all cookies before?
-1
votes
3answers
1k views

ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress

when you change domain or hosting or installation folder ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.
0
votes
1answer
19 views

is_user_logged_in() returns different values on different pages

On most of my site, is_user_logged_in() works perfectly. On two pages with similar custom templates set, this incorrectly returns FALSE. The user can navigate back to other pages where it works ...
0
votes
1answer
37 views

Login with cookie but without using WordPress code

I have been looking for a way to authenticate users without having to load up WordPress every time. To put it simply, I am generating apps that don't make use of web kits of any kind so when WordPress ...
0
votes
2answers
745 views

Wordpress delete cookie

First sorry for my bad english, i'm french. I need to make my website GDPR Friendly, so for this I use the plugin 'RGPD' who give me the possibility to check or uncheck multiples types of cookies. ...
0
votes
0answers
30 views

How to remove a cookie

First sorry for my bad english, I'm french. I have a WordPress website and I need to make it compliant for GDPR. So I need to find a way to remove cookies, I make it with google analytics but they ...
0
votes
0answers
15 views

Login session doesn't stay throughout the pages

This is really weird as I have WooCommerce (v3.4.2) in my Wordpress. I used is_user_logged_in() in a function and hooked it to wp_footer. It's just a simple function that echoes out LOGGED IN if ...
0
votes
1answer
78 views

Is there any reason only 1 (my) IP would be added to this table using $wpdn->insert?

I'm using a small custom plugin to create a table in the database and then add a user's IP address to the table if a certain cookie exists (this cookie is set elsewhere by clicking a term acceptance ...
0
votes
1answer
35 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
69 views

Create simple Cookie Box for Wordpress

I have been trying to create a simple cookie box notification, and i actually would like to use this specific idea The problem is that when i run this js in my footer, and i just click the 'yes' or '...
0
votes
0answers
96 views

What Cookies wordpress use by default

Hi in my understanding wordpress is not using any cookie by default [talking about non logged in user]. But as per new GDPR law , i have to mention what cookie wordpress is creating in visitor ...
0
votes
1answer
207 views

WordPress load javascript file if something… (after the page is loaded)

I'm having an issue with making a website GDPR ready. It is loading a javascript file for InstraGram that is setting a cookie. I was able to locate where this file is loaded in the plug-in directory ...
0
votes
0answers
38 views

Controlling cookies from all plugins

Is there any way to create a cookie-consent badge that applies to all cookies from every that is plug-in installed? The EU Cookie Law plugin prevents embedded files and social media sharing buttons. ...
0
votes
0answers
114 views

Cookie for first entered page. setcookie not working for logged out users?

I want to have a function that sets a cookie on the first page a user enters. So, if the user signs up, I can save the content of the cookie in his profile, so that I know which page a user enters ...
0
votes
1answer
240 views

Do I need a Cookie consent on a basic WordPress site?

Does a basic WordPress site, which doesn't have user accounts or a login (other than admin) and doesn't sell anything, still need a cookie consent message? The site simply provides information and ...
1
vote
1answer
32 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') ) { ...