Introduce woocommerce_cookie_httponly filter on the httponly param of setcookie.

This commit is contained in:
Gerhard Potgieter 2017-11-29 11:22:57 +02:00
parent b1b9f57a91
commit be4a2553b1
1 changed files with 1 additions and 1 deletions

View File

@ -773,7 +773,7 @@ function wc_print_js() {
*/
function wc_setcookie( $name, $value, $expire = 0, $secure = false ) {
if ( ! headers_sent() ) {
setcookie( $name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure );
setcookie( $name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure, apply_filters( 'woocommerce_cookie_httponly', false ) );
} elseif ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
headers_sent( $file, $line );
trigger_error( "{$name} cookie cannot be set - headers already sent by {$file} on line {$line}", E_USER_NOTICE );