-
Notifications
You must be signed in to change notification settings - Fork 384
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
Limit validation to AMP theme support #1132
Conversation
Thanks, Will Review Soon Hi @westonruter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved
Hi @westonruter,
Thanks, this pull request looks good, and works as expected. There are no validation errors when using Legacy Templating. Only in Native AMP or Paired Mode.
It's nice that this also simplifies the repo, using less if
blocks.
There's a question here, but it's not a blocker.
$validation_errors = array(); | ||
// Skip if the post type is not viewable on the frontend, since we need a permalink to validate. | ||
if ( ! is_post_type_viewable( $post->post_type ) ) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to exit if the post type isn't viewable.
// Make sure original post is restored after applying shortcodes which could change it. | ||
$GLOBALS['post'] = $post; // WPCS: override ok. | ||
setup_postdata( $post ); | ||
if ( $validation_status_post ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be an else
block?
if ( ! $validation_status_post ) {
return;
} else {
$validation_errors = json_decode( $validation_status_post->post_content, true );
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, there's no need for the if
at all here. Good point.
* Fixes problems related to the_content filters being applied in the admin. * Eliminates validation errors from being displayed when the_content filters apply when creating new posts. * Reduces influx of support topics related to warning messages; the debug link is not helpful unless theme support is present.
871bf4f
to
801b9cf
Compare
the_content
filters being applied in the admin. See amp plugin causing inability to view posts #1130.the_content
filters apply when creating new posts.To test:
git clone --recursive https://github.com/Automattic/amp-wp.git amp cd amp git checkout update/warning-notice npm install composer install npm run build
This will create an
amp.zip
file that you can install on your site. Note you'll have to first deactivate and uninstall the v0.7.0 AMP plugin before you can upload and activate this ZIP on the plugins admin screen. Ideally you could test this on a staging site.Support tickets: