ERROR: Cookies are blocked or not supported by your browser
It turns out I had DOMAIN_CURRENT_SITE set incorrectly in wp-config.php. (This particular install was a copy of another server, and the domain hadn’t fully been changed.)
It turns out I had DOMAIN_CURRENT_SITE set incorrectly in wp-config.php. (This particular install was a copy of another server, and the domain hadn’t fully been changed.)
An idea is to use some CSS if you want to apply this logic to many elements on different pages. You can add this code to header.php for example : if(!isset($_COOKIE[“user_type”])) { <style>.hide_content {display:none!important}</style> } Then you can simply add the CSS class to all elements you want to hide when cookies are set.
This answer may help. To quote: The basic code you need here is this in the wp-config file: define(‘LOGGED_IN_COOKIE’, ‘login_cookie_name’); define(‘AUTH_COOKIE’,’auth_cookie_name’); define(‘COOKIE_DOMAIN’, ‘.example.com’); define(‘COOKIEHASH’, ‘random_hash_here’); Put that in the config across multiple sites, set the keys and salts to be the same, and you’ll have login cookies that work across the domain and subdomains.
Yes, any WordPress site does uses cookies. By default, WordPress uses cookies to verify who the user is, i.e. if the user is logged-in (registered user) or is a commenter on the site. (More Info.) Plugins and theme’s may set cookies. For example, Cookies for Comments plugin uses cookies to prevent comment spam. Cookies have … Read more
As I’ve found, this happens when your html, css or javascript tries to load a resource and you haven’t specified a path or wrongly specified root. For instance, I’ve seen examples on people having this problem while doing <img src=”http://example.com” /> background:url(); In my case specifically, was assigning $.ajax() to a global variable so I … Read more
You can accomplish what you’re after by first creating a hidden field in your form. Set the value to the current embed page: Take note of the hidden fields ID, for this demo, it’s 3. Then your code for the content is similar to what you had: add_action( ‘the_content’, function ($content) { // check if … Read more
The cookie looks like it is being set by the PHP session handling process. WordPress ‘out of the box’ doesn’t use sessions, which would seem to point towards either your theme or a plugin. If you search your code base for ‘session_start’ you may be able to track down where the session is being initiated. … Read more
AFAIK URL encoding the cookie value is still kind of a defacto standard, it’s an ancient relict based on the old, ugly Netscape cookie specs, that basically says that semicolons, commas and whitespaces are disallowed, and should be encoded, for example using URL encoding. Neither does it does it require enocding, nor does it force … Read more
The function wp_logout (https://github.com/WordPress/WordPress/blob/master/wp-includes/pluggable.php#L564) calls the function wp_clear_auth_cookie (https://github.com/WordPress/WordPress/blob/master/wp-includes/pluggable.php#L928) which sets the expiration dates of all involved cookies to something in the past. Also for the LOGGED_IN_COOKIE. Hence, what you observe is strange. For sites that I maintain, the cookie will be cleared when I log out.
Why are you building a seperate user system in the first place? The wordpress builtin system is pretty flexible. In theory all the login functions like wp_set_auth_cookie(), wp_generate_auth_cookie(), wp_parse_auth_cookie() etc. are all pluggable functions. Which means you can replace them with your own custom functions. But to be realistic, it will be a lot of … Read more