Snippets Collections
function mind_set_cookie_expire( $time ) {

return time() + 86400;  // 1 day

}

add_filter( 'post_password_expires', 'mind_set_cookie_expire' );
window.location.search.includes('cro_mode=qa')

// or

window.location.search.indexOf('cro_mode=qa') > -1

// finding it in cookies: 
function getCookie(name) {
  const value = `; ${document.cookie}`;
  const parts = value.split(`; ${name}=`);
  if (parts.length === 2) return parts.pop().split(';').shift();
}
//then...
getCookie('cro_mode')

//or something like ...
  const parts = document.cookie.split('cro_mode');
  if (parts.length === 2) {console.log(parts.pop().split(';').shift())}
<script data-cookieconsent="ignore">
    window.dataLayer = window.dataLayer || [];
    function gtag() {
        dataLayer.push(arguments);
    }
    gtag("consent", "default", {
        ad_storage: "denied",
        analytics_storage: "denied",
        functionality_storage: "denied",
        personalization_storage: "denied",
        security_storage: "granted",
        wait_for_update: 2000,
    });
    gtag("set", "ads_data_redaction", true);
</script>
const str  = 'mycookie=test';

const spl = str.split(';');

const x = spl.map(v => v.split('='))
.map(([k, ...vs]) => [k, vs.join('=')]).reduce((acc, [k, v]) ={
       acc[k.trim()] = decodeURIComponent(v);
       return acc;
 }, {});

console.log(x);
star

Mon Apr 24 2023 05:43:06 GMT+0000 (Coordinated Universal Time) https://passwordprotectwp.com/wordpress-password-protected-page-cookie/

#password #cookie
star

Tue Feb 14 2023 21:44:06 GMT+0000 (Coordinated Universal Time)

#test #cookie
star

Fri Oct 22 2021 16:17:25 GMT+0000 (Coordinated Universal Time) https://support.cookiebot.com/hc/en-us/articles/360016047000

#cookie #consent #script #head #tracking
star

Sat Aug 07 2021 04:35:46 GMT+0000 (Coordinated Universal Time) https://jsbin.com/

#cookie #js

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension