add cookie consent filter
for https://github.com/woocommerce/woocommerce/issues/31118
This commit is contained in:
parent
d64c4492c1
commit
923a23d0bc
|
@ -1048,6 +1048,10 @@ function wc_print_js() {
|
|||
* @param bool $httponly Whether the cookie is only accessible over HTTP, not scripting languages like JavaScript. @since 3.6.0.
|
||||
*/
|
||||
function wc_setcookie( $name, $value, $expire = 0, $secure = false, $httponly = false ) {
|
||||
if ( apply_filters( 'woocommerce_cookie_consent', true, $name ) === false && !Constants::is_true( 'WP_DEBUG' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! headers_sent() ) {
|
||||
setcookie( $name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure, apply_filters( 'woocommerce_cookie_httponly', $httponly, $name, $value, $expire, $secure ) );
|
||||
} elseif ( Constants::is_true( 'WP_DEBUG' ) ) {
|
||||
|
|
Loading…
Reference in New Issue