My WordPress head tag contain custom style tag for fonts which inserted automatically on all page. Which causes following AMP error,

Only amp-boilerplate and amp-custom 'style' tags are allowed, and only in the document head.

How to remove it?

1 Answer 1


In my case the style tag was added by the flying font plugin. I have modified the file 'wp-content/plugins/flying-fonts/flying-fonts.php'

$style =
"<style>body{font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Fira Sans','Droid Sans','Helvetica Neue',sans-serif !important}code{font-family:Menlo,Consolas,Monaco,Liberation Mono,Lucida Console,monospace !important}</style>";
$style =''; // set the style as ''
$html = str_replace('</head>', $style . '</head>', $html);

And i have added the style manually in non AMP page header.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.