diff --git src/wp-admin/includes/misc.php src/wp-admin/includes/misc.php
index ea7d76dee6..e4621c6336 100644
|
|
function wp_admin_canonical_url() { |
1132 | 1132 | $filtered_url = remove_query_arg( $removable_query_args, $current_url ); |
1133 | 1133 | ?> |
1134 | 1134 | <link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url( $filtered_url ); ?>" /> |
1135 | | <script> |
1136 | | if ( window.history.replaceState ) { |
1137 | | window.history.replaceState( null, null, document.getElementById( 'wp-admin-canonical' ).href + window.location.hash ); |
1138 | | } |
1139 | | </script> |
1140 | | <?php |
| 1135 | <?php |
| 1136 | wp_remove_feedback_query_args( 'wp-admin-canonical' ); |
1141 | 1137 | } |
1142 | 1138 | |
1143 | 1139 | /** |
diff --git src/wp-comments-post.php src/wp-comments-post.php
index 1836166fcd..d4b7c0a837 100644
|
|
do_action( 'set_comment_cookies', $comment, $user, $cookies_consent ); |
53 | 53 | |
54 | 54 | $location = empty( $_POST['redirect_to'] ) ? get_comment_link( $comment ) : $_POST['redirect_to'] . '#comment-' . $comment->comment_ID; |
55 | 55 | |
| 56 | if ( ! $cookies_consent && 'unapproved' === wp_get_comment_status( $comment ) ) { |
| 57 | $location = add_query_arg( 'unapproved', $comment->comment_ID, $location ); |
| 58 | } |
| 59 | |
56 | 60 | /** |
57 | 61 | * Filters the location URI to send the commenter after posting. |
58 | 62 | * |
diff --git src/wp-includes/comment-template.php src/wp-includes/comment-template.php
index bcda28f87c..d807013b9f 100644
|
|
function get_comment_reply_link( $args = array(), $comment = null, $post = null |
1692 | 1692 | |
1693 | 1693 | $link = sprintf( |
1694 | 1694 | "<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>", |
1695 | | esc_url( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $args['respond_id'], |
| 1695 | esc_url( add_query_arg( array( 'replytocom' => $comment->comment_ID, 'unapproved' => false ) ) ) . "#" . $args['respond_id'], |
1696 | 1696 | $data_attribute_string, |
1697 | 1697 | esc_attr( sprintf( $args['reply_to_text'], $comment->comment_author ) ), |
1698 | 1698 | $args['reply_text'] |
… |
… |
function comment_form( $args = array(), $post_id = null ) { |
2260 | 2260 | $req = get_option( 'require_name_email' ); |
2261 | 2261 | $html_req = ( $req ? " required='required'" : '' ); |
2262 | 2262 | $html5 = 'html5' === $args['format']; |
2263 | | $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; |
| 2263 | $consent = empty( $commenter['cookies_consent'] ) ? '' : ' checked="checked"'; |
2264 | 2264 | $fields = array( |
2265 | 2265 | 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' . |
2266 | 2266 | '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $html_req . ' /></p>', |
diff --git src/wp-includes/comment.php src/wp-includes/comment.php
index 6b6e7b45af..a5498d7d82 100644
|
|
function _clear_modified_cache_on_transition_comment_status( $new_status, $old_s |
1741 | 1741 | * @see sanitize_comment_cookies() Use to sanitize cookies |
1742 | 1742 | * |
1743 | 1743 | * @since 2.0.4 |
| 1744 | * @since 4.9.6 Tries to get a query parameter containing the comment ID to |
| 1745 | * set the comment author data when the user has not consented |
| 1746 | * to cookies. |
1744 | 1747 | * |
1745 | | * @return array Comment author, email, url respectively. |
| 1748 | * @return array Comment author, email, url, cookies consent respectively. |
1746 | 1749 | */ |
1747 | 1750 | function wp_get_current_commenter() { |
1748 | 1751 | // Cookies should already be sanitized. |
… |
… |
function wp_get_current_commenter() { |
1762 | 1765 | $comment_author_url = $_COOKIE[ 'comment_author_url_' . COOKIEHASH ]; |
1763 | 1766 | } |
1764 | 1767 | |
| 1768 | $comment_author_data = compact( 'comment_author', 'comment_author_email', 'comment_author_url' ); |
| 1769 | |
| 1770 | if ( ! array_filter( $comment_author_data ) ) { |
| 1771 | // Set the current commenter using the just posted comment ID. |
| 1772 | if ( is_singular() && isset( $_GET['unapproved'] ) ) { |
| 1773 | $comment = get_comment( $_GET['unapproved'], ARRAY_A ); |
| 1774 | |
| 1775 | if ( isset( $comment['comment_author_email'] ) ) { |
| 1776 | $comment_author_data = array_intersect_key( $comment, $comment_author_data ); |
| 1777 | } |
| 1778 | } |
| 1779 | |
| 1780 | $comment_author_data['cookies_consent'] = false; |
| 1781 | } else { |
| 1782 | $comment_author_data['cookies_consent'] = true; |
| 1783 | } |
| 1784 | |
1765 | 1785 | /** |
1766 | 1786 | * Filters the current commenter's name, email, and URL. |
1767 | 1787 | * |
1768 | 1788 | * @since 3.1.0 |
| 1789 | * @since 4.9.6 Adds the $cookies_consent parameter. |
1769 | 1790 | * |
1770 | 1791 | * @param array $comment_author_data { |
1771 | 1792 | * An array of current commenter variables. |
1772 | 1793 | * |
1773 | | * @type string $comment_author The name of the author of the comment. Default empty. |
1774 | | * @type string $comment_author_email The email address of the `$comment_author`. Default empty. |
1775 | | * @type string $comment_author_url The URL address of the `$comment_author`. Default empty. |
| 1794 | * @type string $comment_author The name of the author of the comment. Default empty. |
| 1795 | * @type string $comment_author_email The email address of the `$comment_author`. Default empty. |
| 1796 | * @type string $comment_author_url The URL address of the `$comment_author`. Default empty. |
| 1797 | * @type boolean $cookies_consent Whether the user consented to cookies or not. Default false. |
1776 | 1798 | * } |
1777 | 1799 | */ |
1778 | | return apply_filters( 'wp_get_current_commenter', compact( 'comment_author', 'comment_author_email', 'comment_author_url' ) ); |
| 1800 | return apply_filters( 'wp_get_current_commenter', $comment_author_data ); |
1779 | 1801 | } |
1780 | 1802 | |
1781 | 1803 | /** |
diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index 6f9e77c5b7..e11e3e34a0 100644
|
|
function wp_removable_query_args() { |
931 | 931 | return apply_filters( 'removable_query_args', $removable_query_args ); |
932 | 932 | } |
933 | 933 | |
| 934 | /** |
| 935 | * Removes query variables used to provide user feedbacks from the current URL. |
| 936 | * |
| 937 | * @since 4.9.6 |
| 938 | * |
| 939 | * @param string $canonical_id The canonical URL link tag's id attribute. |
| 940 | */ |
| 941 | function wp_remove_feedback_query_args( $canonical_id = 'wp-canonical' ) { |
| 942 | printf( ' |
| 943 | <script> |
| 944 | if ( window.history.replaceState ) { |
| 945 | window.history.replaceState( null, null, document.getElementById( \'%1$s\' ).href.split(\'#\')[0] + window.location.hash ); |
| 946 | } |
| 947 | </script> |
| 948 | ', $canonical_id ); |
| 949 | } |
| 950 | |
934 | 951 | /** |
935 | 952 | * Walks the array while sanitizing the contents. |
936 | 953 | * |
… |
… |
function wp_privacy_anonymize_data( $type, $data = '' ) { |
6250 | 6267 | * Trigger the check for policy text changes. |
6251 | 6268 | * |
6252 | 6269 | * @since 4.9.6 |
6253 | | * @access private |
| 6270 | * @access private |
6254 | 6271 | */ |
6255 | 6272 | function _wp_privacy_active_plugins_change() { |
6256 | 6273 | update_option( '_wp_privacy_text_change_check', 'check' ); |
diff --git src/wp-includes/link-template.php src/wp-includes/link-template.php
index 9db1065c77..2f0c5999bd 100644
|
|
function rel_canonical() { |
3730 | 3730 | $url = wp_get_canonical_url( $id ); |
3731 | 3731 | |
3732 | 3732 | if ( ! empty( $url ) ) { |
3733 | | echo '<link rel="canonical" href="' . esc_url( $url ) . '" />' . "\n"; |
| 3733 | echo '<link id="wp-canonical" rel="canonical" href="' . esc_url( $url ) . '" />' . "\n"; |
| 3734 | wp_remove_feedback_query_args(); |
3734 | 3735 | } |
3735 | 3736 | } |
3736 | 3737 | |