why does WordPress need two cookies for auth/login

“On login, wordpress uses the wordpress_[hash] cookie to store your authentication details. It’s use is limited to the admin console area, /wp-admin/ After login, wordpress sets the wordpress_logged_in_[hash] cookie, which indicates when you’re logged in, and who you are, for most interface use. WordPress also sets a few wp-settings-{time}-[UID] cookies. The number on the end … Read more

How to share cookies and sessions between domain and subdomain?

I’ll skip steps related to sharing DB and sharing users data and meta, based on assumption that you’ve done it correctly. Let’s concentrate on wp-config.php of both sites. These are defines that MUST BE IDENTICAL for both sites: define(‘COOKIE_DOMAIN’, ‘.domain.com’); // your main domain define(‘COOKIEPATH’, “https://wordpress.stackexchange.com/”); define(‘COOKIEHASH’, md5(‘domain.com’)); // notice absence of a ‘.’ in … Read more

Passing current cookies in wp_remote_get to get Draft Post Preview

I rarely deal with cookies and not sure about complete mechanics there, but here is basic working example of passing current user’s cookies to retrieve preview page source: $preview_link = set_url_scheme( get_permalink( $post->ID ) ); $preview_link = esc_url( apply_filters( ‘preview_post_link’, add_query_arg( ‘preview’, ‘true’, $preview_link ) ) ); $cookies = array(); foreach ( $_COOKIE as $name … Read more

Setting custom cookies in WordPress

1 – You can check for cookies and do your redirect using hooks that are called before any output like the ‘init’ hook: <?php // Hook the function “redirect()” on to the “init” action add_action(‘init’, ‘redirect’); // redirect() may redirect the user depending on the cookies he has function redirect(){ /* CODE */ } ?> … Read more

Is this Solution for Caches vs Cookies Going to Get Me in Trouble?

Your solution with comment_author_proxyhash cookie will of course technically work – all caching plugins I know doesn’t analyze hash value and will just stop delivery of cached content based on comment_author_* cookie presense. Problem here is that page caching functionality is something websites really need and often page caching is configured exactly because naked WordPress … Read more

How to include landing page with form submission?

Setting a cookie might be the best option. In case the visitor had js disabled, I figured it best to set the cookie in the http header using php. However, it seems that init is the last possible action WordPress will allow a cookie-setting function to hook into, but it fires too early for conditional … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)