WordPress.org

Make WordPress Core

Ticket #16612: comment_cookies_nocache.diff

File comment_cookies_nocache.diff, 1.2 KB (added by westi, 7 years ago)

The fix :)

  • public/wp-includes/class-wp.php

     
    314314                $status = null;
    315315                $exit_required = false;
    316316
    317                 if ( is_user_logged_in() )
     317                if ( is_user_logged_in() || are_comment_cookies_set() )
    318318                        $headers = array_merge($headers, wp_get_nocache_headers());
    319319                if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) {
    320320                        $status = 404;
  • public/wp-includes/comment.php

     
    19951995        return $open;
    19961996}
    19971997
    1998 ?>
     1998/**
     1999 * Check to see if any of the comment author cache cookies are set for this request
     2000 *
     2001 * @return bool Whether or not they are.
     2002 */
     2003function are_comment_cookies_set() {
     2004        if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) || isset($_COOKIE['comment_author_email_'.COOKIEHASH]) || isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) {
     2005                return true;
     2006        }
     2007
     2008        return false;
     2009}
     2010
     2011?>
     2012 No newline at end of file