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
18 views

How save ContactForm7 data in a cookie

I am developing a WordPress theme that has a custom post type called 'Insights'. Then in single-insights.php the administrator can upload a PDF file so that the user can download it by clicking on a ...
0
votes
1answer
12 views

how to increase connection time

actually I'm using this script To increase the connection time // Reste connecté à WordPress durant 1 an add_filter( 'auth_cookie_expiration', 'keep_me_logged_in' ); function keep_me_logged_in( $...
0
votes
1answer
13 views

wordpress can't read a cookie?

This is a recap for my problem - after a form is submitted it will save a token (a cookie token) function set_cookie_token( $entry, $form ) { setcookie('token', 'true', time() + (86400 * 30), "/")...
0
votes
0answers
16 views

How can I set a custom cookie in WordPress?

I'm trying to set a custom cookie in WordPress. Everything I've found on the Internet tells me to use the model below in the functions.php file, which I'm doing in my child theme. Presumably the ...
0
votes
1answer
20 views

Passing cookies when using wp_remote_get

I'm working on a plugin that fetches remote RSS feeds using wp_remote_get. The problem is that Tumblr requires a cookie for GDPR compliance. This includes RSS feeds. Which means all Tumblr feeds are ...
-1
votes
2answers
23 views

How to get the id dynamically to store cookies

Right now I'm getting the id statically in my output "1778a1778" because of array_push(), but I have to send ID dynamically and get the same output.
0
votes
0answers
16 views

Extend Cookie with auth_cookie_expiration not working

I was trying to extend the Login Cookie with the following Code function expiration_filter($seconds, $user_id, $remember){ //if "remember me" is checked; if ( $remember ) { //WP ...
0
votes
0answers
41 views

How can I set cookies on my posts so that I can get view count of that post [duplicate]

Can anyone help with the solution? This is my post and I have created a custom column to get view counts on my single post. I'm want to keep a track of views for every single post. I'm trying to set a ...
0
votes
0answers
26 views

How to check if a user is logged into WordPress via perl-based download script?

I'm trying to implement code into a perl-based download script in order to check if a visitor to a download url has logged into WordPress. Otherwise do not allow the download. The direct download ...
0
votes
0answers
17 views

Can I use setcookie withiut the functions.php file?

I want to store a value if the visitor is on that page. I tried many code but the only way to create a cookie is to create a function an hook to init in the functions.php file. On this way I can not ...
0
votes
0answers
15 views

How to track and restrict external download script by logged in wp users?

My goal is to restrict direct download of external url (which has script) only to wordpress logged in users. I think we should track it by wordpress logged in user cookies. But i need a way to ...
3
votes
1answer
188 views

Why does it say: 'Cookies are blocked or not supported'?

There are many many many many pages about this issue (and I could keep going). For those who just came here for a solution, then it is: 1) Just try and refresh the page. 2) Try putting this in your ...
0
votes
1answer
17 views

Cookie cant be read even cookie is present

add_action( 'wp', 'setCookies', 10); I am using this hook to set cookies. I am using 'wp' because I need to get the current post ID. Now on my sidebar.php, I am calling if(isset($_COOKIE['...
1
vote
1answer
27 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
11 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
59 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
39 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
172 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
219 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
22 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
194 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
141 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
43 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
21 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
18 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
21 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
168 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
265 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
62 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
30 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
17 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
116 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
88 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
62 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
66 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
27 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 ...
1
vote
0answers
118 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
22 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
17 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
101 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
26 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
178 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
37 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
29 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
50 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 ...