-
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
Remove warnings and notices #2154
Comments
Which notices are you referring to? Please provide screenshots or other pointers. |
If referring to the AMP validation error warnings, the way to hide them is to accept the validation errors. @amedina We may want to make that explicit in the warning. I realize that we may not explain how to get rid of that warning. Currently it says:
This could be amended with more details. @andremacola Please confirm the notices you are referring to. |
@westonruter yes this is the notices. I work for a relative big newspaper and this notices is annoying for the journalists. I think they need to appear (in our case) only for developers and the main editor. We had some hard-working to migrate all of our system to Gutenberg, the journalists (specially the old ones) don't care about blocks and this kind of technical notice, they just want to write their text. What I am doing right now is using |
Wouldn't it be important for the writers to know that some of the blocks they are authoring are going to be stripped from the AMP page? It seems an important tool for them to report a block problem to you. Also, what are the validation errors you are seeing? Can't you mark the validation errors as accepted and then the writers won't see the warnings anymore? |
Not all the writers. Just the editors. The editor in our case is the guy who manage the team, approve the content and publish to the home and other types of media like a physical newspaper. One of the notices is the video embed from the other ticket and some of our own stuff that for now is not amp compatible. |
OK, I think if we can fix the problem with #2156 then I can share a couple other filters which will reduce the noise for the validation errors that you are getting. Namely, the |
Nice. Thks for the help @westonruter |
@andremacola You mean the Would you mind sharing examples of how you are using it? This would be helpful to know how useful it is for developers. |
@westonruter actually is It's very simple by the way. It's like:
I'll check the |
@andremacola I don't see The intended usage of the Given you have some HTML like this: <iframe src="https://example.com/video/12345" onload="Foo.loaded(this)"></iframe> Consider Now consider you have thousands such iframes, where the {
"element_attributes": {
"src": "https://example.com/video/12345",
"onload": "Foo.loaded(this)",
"sandbox": "allow-scripts allow-same-origin",
"height": "400",
"layout": "fixed-height"
},
"node_name": "onload",
"parent_name": "amp-iframe",
"code": "invalid_attribute",
"type": "js_error"
} So what is needed is to normalize the error across all instances. And this can be done in this example as follows: add_filter(
'amp_validation_error',
function ( $error ) {
$video_base_url = 'https://example.com/video/';
$is_video_iframe = (
isset( $error['node_name'], $error['parent_name'], $error['element_attributes']['src'] )
&&
'onload' === $error['node_name']
&&
'amp-iframe' === $error['parent_name']
&&
substr( $error['element_attributes']['src'], 0, strlen( $video_base_url ) ) === $video_base_url
);
if ( $is_video_iframe ) {
// Normalize URL across validation errors.
$error['element_attributes']['src'] = $video_base_url . '{id}';
}
return $error;
}
); Now with this in place, every validation error for every such video And now you can just accept this one validation error once and every other instance of the validation error will have that same status, and the writer will not be shown a validation error in the editor. This is the intended usage of the |
hey @westonruter I known, I searched inside the plugin files and did not find the I'll try to find again when the time permit. I just want to disable all kind of warnings from some kind os users, and believe, the simple little hook it just works for me. |
We're going to work toward making the warnings more user-friendly for non-administrators, including providing them a way to easily escalate the issue to the administrator. See #2316. |
How to remove all the warnings and notices from the post edit page? Classical and Block editor.
The text was updated successfully, but these errors were encountered: