Skip to content

Commit 19d6db0

Browse files
committed
Ensure AMP is available when moderate/loose sandboxing is enabled and there are stored validation errors
1 parent a9654fe commit 19d6db0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

includes/amp-helper-functions.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,9 @@ function amp_is_available() {
534534

535535
// If not in an AMP-first mode, check if there are any validation errors with kept invalid markup for this URL.
536536
// And if so, and if the user cannot do validation (since they can always get fresh validation results), then
537-
// AMP is not available.
538-
if ( ! amp_is_canonical() && ! AMP_Validation_Manager::has_cap() ) {
537+
// AMP is not available. This only applies if Sandboxing is disabled or the Strict sandboxing mode is on,
538+
// since in Loose or Moderate sandboxing modes, invalid AMP markup can still be served.
539+
if ( ! amp_is_canonical() && ! AMP_Validation_Manager::has_cap() && in_array( amp_get_sandboxing_level(), [ 0, 3 ], true ) ) {
539540
$validation_errors = AMP_Validated_URL_Post_Type::get_invalid_url_validation_errors(
540541
amp_get_current_url(),
541542
[ 'ignore_accepted' => true ]

0 commit comments

Comments
 (0)