<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[57358] branches/6.4/tests/phpunit/tests: Media: Redirect inactive attachment pages for logged-out users.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/57358">57358</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/57358","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>jorbin</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-01-25 19:41:24 +0000 (Thu, 25 Jan 2024)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Media: Redirect inactive attachment pages for logged-out users.

Ensure logged out users are redirected to the media file when attachment pages are inactive. This removes the read_post capability check from the canonical redirects as anonymous users lack the permission.

This was previously committed in <a href="https://core.trac.wordpress.org/changeset/57310">[57310]</a> before being reverted in <a href="https://core.trac.wordpress.org/changeset/57318">[57318]</a>. This update includes a fix to cover instances where revealing a URL could be considered a data leak and greatly expands the unit tests to ensure that this is covered along with many other instances.

Follow-up to <a href="https://core.trac.wordpress.org/changeset/56657">[56657]</a>, <a href="https://core.trac.wordpress.org/changeset/56658">[56658]</a>, <a href="https://core.trac.wordpress.org/changeset/56711">[56711]</a>, <a href="https://core.trac.wordpress.org/changeset/57310">[57310]</a>, <a href="https://core.trac.wordpress.org/changeset/57318">[57318]</a>.

Reviewed by joemcgill.
Merges <a href="https://core.trac.wordpress.org/changeset/57357">[57357]</a> to 6.4 branch.

Props peterwilsoncc, jorbin, afercia, aristath, chesio, joppuyo, jorbin, lakshmananphp, poena, sergeybiryukov, swissspidy, johnbillion, mukesh27.
Fixes <a href="https://core.trac.wordpress.org/ticket/59866">#59866</a>.
See <a href="https://core.trac.wordpress.org/ticket/57913">#57913</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches64srcwpincludescanonicalphp">branches/6.4/src/wp-includes/canonical.php</a></li>
<li><a href="#branches64testsphpunittestscanonicalpostStatusphp">branches/6.4/tests/phpunit/tests/canonical/postStatus.php</a></li>
<li><a href="#branches64testsphpunittestscanonicalphp">branches/6.4/tests/phpunit/tests/canonical.php</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#branches64">branches/6.4/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/6.4
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- branches/6.4 2024-01-25 17:34:54 UTC (rev 57357)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/6.4  2024-01-25 19:41:24 UTC (rev 57358)
</ins><a id="branches64"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/6.4</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43747,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43785,43790-43806,43808-43821,43825,43828,43830-43834,43836-43843,43846-43863,43867-43889,43891-43894,43897-43905,43908-43909,43911-43929,43931-43942,43946-43947,43949-43956,43959-43964,43967-43969,43988,43994,44014,44017,44047,44183,44185,44187-44206,44208-44213,44231-44232,44235,44248,44284,44287-44288
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/5.5:49373-49379,49381
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/5.8:51889
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/trunk:56974,56978,56984,56987,56990-56992,56996,56999,57003,57009,57012-57013,57018-57019,57021-57022,57028-57029,57032-57034,57036,57044,57046,57048,57054,57063,57066-57067,57069,57075,57081,57084,57086,57089,57093,57102,57127,57129,57142,57147,57151,57163,57212,57275-57277,57296,57306
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/trunk:56974,56978,56984,56987,56990-56992,56996,56999,57003,57009,57012-57013,57018-57019,57021-57022,57028-57029,57032-57034,57036,57044,57046,57048,57054,57063,57066-57067,57069,57075,57081,57084,57086,57089,57093,57102,57127,57129,57142,57147,57151,57163,57212,57275-57277,57296,57306,57357
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches64srcwpincludescanonicalphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/6.4/src/wp-includes/canonical.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.4/src/wp-includes/canonical.php        2024-01-25 17:34:54 UTC (rev 57357)
+++ branches/6.4/src/wp-includes/canonical.php  2024-01-25 19:41:24 UTC (rev 57358)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -548,13 +548,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $is_attachment_redirect = false;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( is_attachment() && ! get_option( 'wp_attachment_pages_enabled' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $attachment_id = get_query_var( 'attachment_id' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $attachment_id        = get_query_var( 'attachment_id' );
+               $attachment_post      = get_post( $attachment_id );
+               $attachment_parent_id = $attachment_post ? $attachment_post->post_parent : 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( current_user_can( 'read_post', $attachment_id ) ) {
-                       $redirect_url = wp_get_attachment_url( $attachment_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $attachment_url = wp_get_attachment_url( $attachment_id );
+               if ( $attachment_url !== $redirect_url ) {
+                       /*
+                       * If an attachment is attached to a post, it inherits the parent post's status. Fetch the
+                       * parent post to check its status later.
+                       */
+                       if ( $attachment_parent_id ) {
+                               $redirect_obj = get_post( $attachment_parent_id );
+                       }
+                       $redirect_url = $attachment_url;
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $is_attachment_redirect = true;
-               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $is_attachment_redirect = true;
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
</span></span></pre></div>
<a id="branches64testsphpunittestscanonicalpostStatusphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/6.4/tests/phpunit/tests/canonical/postStatus.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.4/tests/phpunit/tests/canonical/postStatus.php 2024-01-25 17:34:54 UTC (rev 57357)
+++ branches/6.4/tests/phpunit/tests/canonical/postStatus.php   2024-01-25 19:41:24 UTC (rev 57358)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -169,8 +169,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function set_up() {
</span><span class="cx" style="display: block; padding: 0 10px">                parent::set_up();
</span><span class="cx" style="display: block; padding: 0 10px">                self::setup_custom_types();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-               add_filter( 'pre_option_wp_attachment_pages_enabled', '__return_true' );
</del><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -223,8 +221,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $user_role User role.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $requested Requested URL.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $expected  Expected URL.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @param string $enable_attachment_pages Whether to enable attachment pages. Default true.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public function test_canonical_redirects_to_plain_permalinks( $post_key, $user_role, $requested, $expected ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function test_canonical_redirects_to_plain_permalinks( $post_key, $user_role, $requested, $expected, $enable_attachment_pages = true ) {
+               if ( $enable_attachment_pages ) {
+                       update_option( 'wp_attachment_pages_enabled', 1 );
+               } else {
+                       update_option( 'wp_attachment_pages_enabled', 0 );
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 wp_set_current_user( self::$users[ $user_role ] );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->set_permalink_structure( '' );
</span><span class="cx" style="display: block; padding: 0 10px">                $post = self::$posts[ $post_key ];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -243,12 +248,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Data provider for test_canonical_redirects_to_plain_permalinks.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @return array[] Array of arguments for tests {
-        *     @type string $post_key  Post key used for creating fixtures.
-        *     @type string $user_role User role.
-        *     @type string $requested Requested URL.
-        *     @type string $expected  Expected URL.
-        * }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @return array[]
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        public function data_canonical_redirects_to_plain_permalinks() {
</span><span class="cx" style="display: block; padding: 0 10px">                $data              = array();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -273,15 +273,33 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-page",
+                                       $user,
+                                       '/?post_type=page&p=%ID%',
+                                       '/?post_type=page&p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       "/?name=$post_key-post",
+                                       "/?name=$post_key-post",
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure rss redirects to rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -288,8 +306,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss2&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss2&p=%ID%',
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure rss redirects to rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-page",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -296,7 +323,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss2&page_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
+                                       '/?feed=rss&page_id=%ID%',
+                                       '/?feed=rss2&page_id=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -311,15 +347,33 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-page",
+                                       $user,
+                                       '/?post_type=page&p=%ID%',
+                                       '/?post_type=page&p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       "/?name=$post_key-post",
+                                       "/?name=$post_key-post",
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure rss redirects to rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -326,8 +380,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss2&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss2&p=%ID%',
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure rss redirects to rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-page",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -334,7 +397,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss2&page_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
+                                       '/?feed=rss&page_id=%ID%',
+                                       '/?feed=rss2&page_id=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        foreach ( $select_block_list as $user ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -347,15 +419,33 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-page",
+                                       $user,
+                                       '/?post_type=page&p=%ID%',
+                                       '/?post_type=page&p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       "/?name=$post_key-post",
+                                       "/?name=$post_key-post",
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure post's existence is not demonstrated by changing rss to rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -362,8 +452,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss&p=%ID%',
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure post's existence is not demonstrated by changing rss to rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-page",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -370,7 +469,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
+                                       '/?feed=rss&page_id=%ID%',
+                                       '/?feed=rss&page_id=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -385,15 +493,33 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-page",
+                                       $user,
+                                       '/?post_type=page&p=%ID%',
+                                       '/?post_type=page&p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       "/?name=$post_key-post",
+                                       "/?name=$post_key-post",
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure post's existence is not demonstrated by changing rss to rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -400,8 +526,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss&p=%ID%',
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure post's existence is not demonstrated by changing rss to rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-page",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -408,7 +543,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
+                                       '/?feed=rss&page_id=%ID%',
+                                       '/?feed=rss&page_id=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -423,15 +567,33 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-page",
+                                       $user,
+                                       '/?post_type=page&p=%ID%',
+                                       '/?post_type=page&p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       "/?name=$post_key-post",
+                                       "/?name=$post_key-post",
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure post's existence is not demonstrated by changing rss to rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -438,8 +600,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss&p=%ID%',
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure post's existence is not demonstrated by changing rss to rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-page",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -446,7 +617,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
+                                       '/?feed=rss&page_id=%ID%',
+                                       '/?feed=rss&page_id=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -457,22 +637,49 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?a-public-cpt=a-public-cpt',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?p=%ID%',
+                                       '/?a-public-cpt=a-public-cpt',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-attachment",
+                                       $user,
+                                       '/?attachment_id=%ID%',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key&post_type=$post_key",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key&post_type=$post_key",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       "/?name=$post_key&post_type=$post_key",
+                                       "/?name=$post_key&post_type=$post_key",
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure rss is replaced by rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -479,7 +686,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?a-public-cpt=a-public-cpt&feed=rss2',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?a-public-cpt=a-public-cpt&feed=rss2',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        foreach ( $select_block_list as $user ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -488,22 +704,49 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?p=%ID%',
+                                       '/?p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-attachment",
+                                       $user,
+                                       '/?attachment_id=%ID%',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key&post_type=$post_key",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key&post_type=$post_key",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       "/?name=$post_key&post_type=$post_key",
+                                       "/?name=$post_key&post_type=$post_key",
+                                       false,
+                               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Ensure rss is not replaced with rss2.
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -510,7 +753,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss&p=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -521,28 +773,64 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?p=%ID%',
+                                       '/?p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-attachment",
+                                       $user,
+                                       '/?attachment_id=%ID%',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key&post_type=$post_key",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key&post_type=$post_key",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "/?name=$post_key&post_type=$post_key",
+                                       "/?name=$post_key&post_type=$post_key",
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss&p=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -559,8 +847,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $user_role User role.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $requested Requested URL.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $expected  Expected URL.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @param string $enable_attachment_pages Whether to enable attachment pages. Default true.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public function test_canonical_redirects_to_pretty_permalinks( $post_key, $user_role, $requested, $expected ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function test_canonical_redirects_to_pretty_permalinks( $post_key, $user_role, $requested, $expected, $enable_attachment_pages = true ) {
+               if ( $enable_attachment_pages ) {
+                       update_option( 'wp_attachment_pages_enabled', 1 );
+               } else {
+                       update_option( 'wp_attachment_pages_enabled', 0 );
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 wp_set_current_user( self::$users[ $user_role ] );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->set_permalink_structure( '/%postname%/' );
</span><span class="cx" style="display: block; padding: 0 10px">                $post = self::$posts[ $post_key ];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -605,49 +900,112 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-post/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?p=%ID%',
+                                       "/$post_key-post/",
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-post/$post_key-inherited-attachment/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-attachment",
+                                       $user,
+                                       '/?attachment_id=%ID%',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-page/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        '/?post_type=page&p=%ID%',
+                                       "/$post_key-page/",
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-page/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-page",
+                                       $user,
+                                       '/?page_id=%ID%',
+                                       "/$post_key-page/",
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-post/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "/?name=$post_key-post",
+                                       "/$post_key-post/",
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-post/feed/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       "/$post_key-post/feed/",
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-page/feed/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
+                                       '/?feed=rss&page_id=%ID%',
+                                       "/$post_key-page/feed/",
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -658,49 +1016,112 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-post/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?p=%ID%',
+                                       "/$post_key-post/",
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-post/$post_key-inherited-attachment/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-attachment",
+                                       $user,
+                                       '/?attachment_id=%ID%',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-page/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        '/?post_type=page&p=%ID%',
+                                       "/$post_key-page/",
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-page/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-page",
+                                       $user,
+                                       '/?page_id=%ID%',
+                                       "/$post_key-page/",
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-post/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "/?name=$post_key-post",
+                                       "/$post_key-post/",
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-post/feed/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       "/$post_key-post/feed/",
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key-page/feed/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
+                                       '/?feed=rss&page_id=%ID%',
+                                       "/$post_key-page/feed/",
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        foreach ( $select_block_list as $user ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -709,49 +1130,112 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?p=%ID%',
+                                       '/?p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-attachment",
+                                       $user,
+                                       '/?attachment_id=%ID%',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        '/?post_type=page&p=%ID%',
+                                       '/?post_type=page&p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?page_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-page",
+                                       $user,
+                                       '/?page_id=%ID%',
+                                       '/?page_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "/?name=$post_key-post",
+                                       "/?name=$post_key-post",
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss&p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
+                                       '/?feed=rss&page_id=%ID%',
+                                       '/?feed=rss&page_id=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -762,28 +1246,64 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key/$post_key/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?p=%ID%',
+                                       "/$post_key/$post_key/",
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key/$post_key/$post_key-inherited-attachment/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-attachment",
+                                       $user,
+                                       '/?attachment_id=%ID%',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key&post_type=$post_key",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key/$post_key/?post_type=$post_key",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "/?name=$post_key&post_type=$post_key",
+                                       "/$post_key/$post_key/?post_type=$post_key",
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/$post_key/$post_key/feed/",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       "/$post_key/$post_key/feed/",
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        foreach ( $select_block_list as $user ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -792,28 +1312,64 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?p=%ID%',
+                                       '/?p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-attachment",
+                                       $user,
+                                       '/?attachment_id=%ID%',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key&post_type=$post_key",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key&post_type=$post_key",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "/?name=$post_key&post_type=$post_key",
+                                       "/?name=$post_key&post_type=$post_key",
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss&p=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -824,29 +1380,64 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?p=%ID%',
+                                       '/?p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        // "/$post_key-inherited-attachment/",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-attachment",
+                                       $user,
+                                       '/?attachment_id=%ID%',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key&post_type=$post_key",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key&post_type=$post_key",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "/?name=$post_key&post_type=$post_key",
+                                       "/?name=$post_key&post_type=$post_key",
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss&p=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -857,49 +1448,112 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?p=%ID%',
+                                       '/?p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-attachment",
+                                       $user,
+                                       '/?attachment_id=%ID%',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        '/?post_type=page&p=%ID%',
+                                       '/?post_type=page&p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?page_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-page",
+                                       $user,
+                                       '/?page_id=%ID%',
+                                       '/?page_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "/?name=$post_key-post",
+                                       "/?name=$post_key-post",
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss&p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
+                                       '/?feed=rss&page_id=%ID%',
+                                       '/?feed=rss&page_id=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -910,63 +1564,144 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?p=%ID%',
+                                       '/?p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        '/?attachment_id=%ID%',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       "$post_key-attachment",
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/trash-post/trash-post-inherited-attachment/',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-attachment",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        '/trash-post/trash-post-inherited-attachment/',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       "$post_key-attachment",
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/trash-post__trashed/trash-post-inherited-attachment/',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?attachment_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-attachment",
+                                       $user,
+                                       '/trash-post__trashed/trash-post-inherited-attachment/',
+                                       '/?attachment_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?post_type=page&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        '/?post_type=page&p=%ID%',
+                                       '/?post_type=page&p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?page_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "$post_key-page",
+                                       $user,
+                                       '/?page_id=%ID%',
+                                       '/?page_id=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><span class="cx" style="display: block; padding: 0 10px">                                        "/?name=$post_key-post",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        $post_key,
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        "/?name=$post_key-post",
+                                       "/?name=$post_key-post",
+                                       false,
+                               );
+
+                               $data[] = array(
+                                       $post_key,
+                                       $user,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         '/?feed=rss&p=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&p=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $data[] = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $post_key,
+                                       $user,
+                                       '/?feed=rss&p=%ID%',
+                                       '/?feed=rss&p=%ID%',
+                                       false,
+                               );
+
+                               $data[] = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         "$post_key-page",
</span><span class="cx" style="display: block; padding: 0 10px">                                        $user,
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><span class="cx" style="display: block; padding: 0 10px">                                        '/?feed=rss&page_id=%ID%',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        true,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $data[] = array(
+                                       "$post_key-page",
+                                       $user,
+                                       '/?feed=rss&page_id=%ID%',
+                                       '/?feed=rss&page_id=%ID%',
+                                       false,
+                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="branches64testsphpunittestscanonicalphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/6.4/tests/phpunit/tests/canonical.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.4/tests/phpunit/tests/canonical.php    2024-01-25 17:34:54 UTC (rev 57357)
+++ branches/6.4/tests/phpunit/tests/canonical.php      2024-01-25 19:41:24 UTC (rev 57358)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,7 +14,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                parent::set_up();
</span><span class="cx" style="display: block; padding: 0 10px">                wp_set_current_user( self::$author_id );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                add_filter( 'pre_option_wp_attachment_pages_enabled', '__return_true' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         update_option( 'wp_attachment_pages_enabled', 1 );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -406,23 +406,83 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Test canonical redirects for attachment pages when the option is disabled.
+        *
</ins><span class="cx" style="display: block; padding: 0 10px">          * @ticket 57913
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 59866
+        *
+        * @dataProvider data_canonical_attachment_page_redirect_with_option_disabled
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public function test_canonical_attachment_page_redirect_with_option_disabled() {
-               add_filter( 'pre_option_wp_attachment_pages_enabled', '__return_false' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function test_canonical_attachment_page_redirect_with_option_disabled( $expected, $user = null, $parent_post_status = '' ) {
+               update_option( 'wp_attachment_pages_enabled', 0 );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                if ( '' !== $parent_post_status ) {
+                       $parent_post_id = self::factory()->post->create(
+                               array(
+                                       'post_status' => $parent_post_status,
+                               )
+                       );
+               } else {
+                       $parent_post_id = 0;
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $filename = DIR_TESTDATA . '/images/test-image.jpg';
</span><span class="cx" style="display: block; padding: 0 10px">                $contents = file_get_contents( $filename );
</span><span class="cx" style="display: block; padding: 0 10px">                $upload   = wp_upload_bits( wp_basename( $filename ), null, $contents );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $attachment_id   = $this->_make_attachment( $upload );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $attachment_id   = $this->_make_attachment( $upload, $parent_post_id );
+               $attachment_url  = wp_get_attachment_url( $attachment_id );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $attachment_page = get_permalink( $attachment_id );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // Set as anonymous/logged out user.
+               if ( null !== $user ) {
+                       wp_set_current_user( $user );
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->go_to( $attachment_page );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $url      = redirect_canonical( $attachment_page, false );
-               $expected = wp_get_attachment_url( $attachment_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $url = redirect_canonical( $attachment_page, false );
+               if ( is_string( $expected ) ) {
+                       $expected = str_replace( '%%attachment_url%%', $attachment_url, $expected );
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( $expected, $url );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * Data provider for test_canonical_attachment_page_redirect_with_option_disabled().
+        *
+        * @return array[]
+        */
+       public function data_canonical_attachment_page_redirect_with_option_disabled() {
+               return array(
+                       'logged out user, no parent'      => array(
+                               '%%attachment_url%%',
+                               0,
+                       ),
+                       'logged in user, no parent'       => array(
+                               '%%attachment_url%%',
+                       ),
+                       'logged out user, private parent' => array(
+                               null,
+                               0,
+                               'private',
+                       ),
+                       'logged in user, private parent'  => array(
+                               '%%attachment_url%%',
+                               null,
+                               'private',
+                       ),
+                       'logged out user, public parent'  => array(
+                               '%%attachment_url%%',
+                               0,
+                               'publish',
+                       ),
+                       'logged in user, public parent'   => array(
+                               '%%attachment_url%%',
+                               null,
+                               'publish',
+                       ),
+               );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>

</body>
</html>