Skip to content

Commit 353561f

Browse files
committed
Add check to stop redirecting from AMP to non-AMP if sandboxing is not set to strict
1 parent dcccebc commit 353561f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

includes/validation/class-amp-validation-manager.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2032,6 +2032,8 @@ public static function finalize_validation( Document $dom ) {
20322032
return true;
20332033
}
20342034

2035+
$sandboxing_level = amp_get_sandboxing_level();
2036+
20352037
/*
20362038
* In AMP-first, documents with invalid AMP markup can still be served. The amp attribute will be omitted in
20372039
* order to prevent GSC from complaining about a validation error already surfaced inside of WordPress.
@@ -2041,8 +2043,10 @@ public static function finalize_validation( Document $dom ) {
20412043
* Otherwise, if in Paired AMP then redirect to the non-AMP version if the current user isn't an user who
20422044
* can manage validation error statuses (access developer tools) and change the AMP options for the template
20432045
* mode. Such users should be able to see kept invalid markup on the AMP page even though it is invalid.
2046+
*
2047+
* Also, if sandboxing is not set to strict mode, then the page should be displayed to the user.
20442048
*/
2045-
if ( amp_is_canonical() ) {
2049+
if ( amp_is_canonical() || ( 1 === $sandboxing_level || 2 === $sandboxing_level ) ) {
20462050
return true;
20472051
}
20482052

0 commit comments

Comments
 (0)