Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark scripts output by wp_comment_form_unfiltered_html_nonce() and wp_post_preview_js() as being in AMP Dev Mode #6680

Merged
merged 2 commits into from
Nov 16, 2021

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Nov 3, 2021

Summary

When in Transitional mode, I started seeing a validation error for the script output by wp_comment_form_unfiltered_html_nonce(). This is a regression introduced by #6546, where this script is exempted from validation but currently only in Standard mode and when Sandboxing is enabled. This PR ensures that the script is exempted for using Dev Mode when Sandboxing is not enabled.

Before After
image image

This also takes the same approach to no longer suppress the script output by wp_post_preview_js() which is output when previewing a post.

Checklist

  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@westonruter westonruter added this to the v2.2 milestone Nov 3, 2021
@westonruter westonruter force-pushed the fix/wp-comment-form-unfiltered-nonce-script branch from 62a6cb3 to 1916baf Compare November 3, 2021 05:29
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2021

Plugin builds for 2e498de are ready 🛎️!

@westonruter westonruter force-pushed the fix/wp-comment-form-unfiltered-nonce-script branch from 1916baf to b282006 Compare November 16, 2021 04:52
@westonruter westonruter changed the title Mark script output by wp_comment_form_unfiltered_html_nonce() as being in AMP Dev Mode Mark scripts output by wp_comment_form_unfiltered_html_nonce() and wp_post_preview_js() as being in AMP Dev Mode Nov 16, 2021
@westonruter westonruter force-pushed the fix/wp-comment-form-unfiltered-nonce-script branch from f5f25ee to 834724b Compare November 16, 2021 05:14
remove_action( 'wp_head', 'wp_post_preview_js', 1 ); // @todo Instead of function, the script output by wp_post_preview_js() should get data-ampdevmode.
remove_action( 'wp_head', 'wp_oembed_add_host_js' ); // This is not needed when post embeds are embedded via <amp-wordpress-embed>. See <https://github.com/ampproject/amp-wp/issues/809>.
// This is not needed when post embeds are embedded via <amp-wordpress-embed>. See <https://github.com/ampproject/amp-wp/issues/809>.
remove_action( 'wp_head', 'wp_oembed_add_host_js' );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be able to be removed in #6665

@westonruter westonruter force-pushed the fix/wp-comment-form-unfiltered-nonce-script branch from 834724b to 2e498de Compare November 16, 2021 05:29
@westonruter westonruter merged commit 428d072 into develop Nov 16, 2021
@westonruter westonruter deleted the fix/wp-comment-form-unfiltered-nonce-script branch November 16, 2021 05:44
@bartoszgadomski
Copy link
Contributor

QA passed

Tested on post with comments form enabled, with Twenty Nineteen, Twenty Twenty and Twenty Twenty One themes - no validation errors encountered.

@bartoszgadomski bartoszgadomski self-assigned this Dec 13, 2021
@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelogged Whether the issue/PR has been added to release notes. Sandboxing Experiment Validation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants