Chrome doesn’t delete session cookies

I’m trying to set session cookie in javascript like this: document.cookie=”name=alex; path=/” But Chrome doesn’t delete it even if I quit browser and launch it again. I checked in Firefox and Opera and both work as intended – they delete session cookie on browser exit. Is Chrome just ignoring expiration rules? I checked in multiple … Read more

Can’t GET draft posts via REST API from headless frontend

I have a headless install of WordPress on v5.4.0. The frontend can’t GET any post that is in draft status, though when accessing the API url directly the data is returned without an issue. I’m assuming this is cookie/auth related. Note, I’m dynamically grabbing the nonce values from the backend, showing full strings here for … Read more

How can I set cookie in node js using express framework?

In my application, I need to set a cookie using the express framework. I have tried the following code but it’s not setting the cookie. var express = require(‘express’), http = require(‘http’); var app = express(); app.configure(function(){ app.use(express.cookieParser()); app.use(express.static(__dirname + ‘/public’)); app.use(function (req, res) { var randomNumber=Math.random().toString(); randomNumber=randomNumber.substring(2,randomNumber.length); res.cookie(‘cokkieName’,randomNumber, { maxAge: 900000, httpOnly: true }) … Read more

Secure wordpress_logged_in cookie

I have to make sure, that the WordPress cookie set after successful log in, “wordpress_logged_in_[salt-sth]” is set to be available for secure connections only. It looks like that it´s a filter used in pluggable.php, line 653 $secure_logged_in_cookie = apply_filters(‘secure_logged_in_cookie’, false, $user_id, $secure); How can I set it to secure, WITHOUT modifiyng the wordpress core files? … Read more

Cookies vs. sessions

I started using PHP a couple of months ago. For the sake of creating a login system for my website, I read about cookies and sessions and their differences (cookies are stored in the user’s browser and sessions on the server). At that time, I preferred cookies (and who does not like cookies?!) and just … Read more

How to switch css files according to devices and button click?

I am trying to enqueue a responsive css file if the website is opened on mobile devices. Also I want to switch / enqueue a default or non-responsive css file when a button is clicked. The non-responsive css file is the default style sheet which is loaded on desktop. So the requirements are: By default … Read more