-
How top remove inline rank-math-rich-snippet-style-inline-css from header?
<style id="rank-math-rich-snippet-style-inline-css" type="text/css">/*!
* Plugin: Rank Math
* URL: https://rankmath.com/wordpress/plugin/seo-suite/
* Name: rank-math-review-snippet.css
...
-
Hello,
Thank you so much for getting in touch.
Sorry, but we don’t have any way that inline code as it is hardcoded in our plugin. You can proceed to remove that from our plugin source file but it will show up again when you update the plugin.
Can you also let us know from which specific page you saw that code on your website? We cannot seem to replicate such a setup.
Looking forward to helping you.
Hi,
All other snippets, metatags, etc. can be removed with appropriate hooks, but this one cannot?
The snippet appears in my regular posts in WordPress. I don’t need it because I don’t use any styles from you.
I second that. Since update to the latest version (1.0.233) this appears for me too. I cannot find any enqueue directive for this “rank-math-rich-snippet-style” but the css file like in the screenshot is added in the frontend for me as well.
ETA, when I disable the RankMath plugin it disappears
<style id='rank-math-rich-snippet-style-inline-css' type='text/css'> /*! * Plugin: Rank Math * URL: https://rankmath.com/wordpress/plugin/seo-suite/ * Name: rank-math-review-snippet.css */@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(-360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(-360deg)}}@keyframes bounce{from{-webkit-transform:translateY(0px);transform:translateY(0px)}to{-webkit-transform:translateY(-5px);transform:translateY(-5px)}}@-webkit-keyframes bounce{from{-webkit-transform:translateY(0px);transform:translateY(0px)}to{-webkit-transform:translateY(-5px);transform:translateY(-5px)}}@-webkit-keyframes loading{0%{background-size:20% 50% ,20% 50% ,20% 50%}20%{background-size:20% 20% ,20% 50% ,20% 50%}40%{background-size:20% 100%,20% 20% ,20% 50%}60%{background-size:20% 50% ,20% 100%,20% 20%}80%{background-size:20% 50% ,20% 50% ,20% 100%}100%{background-size:20% 50% ,20% 50% ,20% 50%}}@keyframes loading{0%{background-size:20% 50% ,20% 50% ,20% 50%}20%{background-size:20% 20% ,20% 50% ,20% 50%}40%{background-size:20% 100%,20% 20% ,20% 50%}60%{background-size:20% 50% ,20% 100%,20% 20%}80%{background-size:20% 50% ,20% 50% ,20% 100%}100%{background-size:20% 50% ,20% 50% ,20% 50%}}:root{--rankmath-wp-adminbar-height: 0}#rank-math-rich-snippet-wrapper{overflow:hidden}#rank-math-rich-snippet-wrapper h5.rank-math-title{display:block;font-size:18px;line-height:1.4}#rank-math-rich-snippet-wrapper .rank-math-review-image{float:right;max-width:40%;margin-left:15px}#rank-math-rich-snippet-wrapper .rank-math-review-data{margin-bottom:15px}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper{width:100%;padding:0 0 20px 0;float:left;clear:both;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-total{border:0;display:block;margin:0;width:auto;float:left;text-align:left;padding:0;font-size:24px;line-height:1;font-weight:700;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star{float:left;margin-left:15px;margin-top:5px;position:relative;z-index:99;line-height:1}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star .rank-math-review-result-wrapper{display:inline-block;white-space:nowrap;position:relative;color:#e7e7e7}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star .rank-math-review-result-wrapper .rank-math-review-result{position:absolute;top:0;left:0;overflow:hidden;white-space:nowrap;color:#ffbe01}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star .rank-math-review-result-wrapper i{font-size:18px;-webkit-text-stroke-width:1px;font-style:normal;padding:0 2px;line-height:inherit}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star .rank-math-review-result-wrapper i:before{content:"\2605"}body.rtl #rank-math-rich-snippet-wrapper .rank-math-review-image{float:left;margin-left:0;margin-right:15px}body.rtl #rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-total{float:right}body.rtl #rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star{float:right;margin-left:0;margin-right:15px}body.rtl #rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star .rank-math-review-result{left:auto;right:0}@media screen and (max-width: 480px){#rank-math-rich-snippet-wrapper .rank-math-review-image{display:block;max-width:100%;width:100%;text-align:center;margin-right:0}#rank-math-rich-snippet-wrapper .rank-math-review-data{clear:both}}.clear{clear:both} </style>
Hello,
In v1.0.233, we migrated all our Blocks code to block.json, as recommended by WordPress. This method adds inline CSS rules for the block in the header, which you’ll also notice for core blocks.
To remove the inline CSS rules and use a CSS file instead, please add the following code to your theme’s functions.php file:
add_filter( 'register_block_type_args', function( $args, $block_type ) { if ( $block_type !== 'rank-math/rich-snippet' ) { return $args; } $args['style_handles'] = []; return $args; }, 10, 2 ); add_action( 'rank_math/snippet/after_schema_content', function() { wp_enqueue_style( 'rank-math-review-snippet', untrailingslashit( rank_math()->plugin_url() ) . '/includes/modules/schema/blocks/schema/assets/css/schema.css', null, rank_math()->version ); } );
Hope that helps.
since gutenberg and blocks are not used in my theme, this block should also not appear. can you disable output of your blocks depending if blocks are even used?
Hello,
This is the default behavior of WordPress, we cannot change that behavior. As soon as a block is registered with the recommended way using
block.json
it injects the CSS in the header.You will see other CSS added to the page coming from the default WordPress blocks as well.
Don’t hesitate to get in touch if you have any other questions.
Hello, I am still not understand why this is happening since I am not using a block Theme or tempalte. No other css is put in the header.
Hello,
As we mentioned above, even if you don’t use the block editor, that is the default editor of WordPress so the data required by it needs to be loaded on the websites using WordPress.
If you are using a WordPress installation on the latest version, you will see some HTML style tags with data for all the other blocks available on the website, not only the ones from our plugin.
Don’t hesitate to get in touch if you have any other questions.
You must be logged in to reply to this ticket.