Hello,
We apologize for the issue you are facing with Rank Math not considering the shortcodes from Kadence Elements in the SEO score calculations. Thank you for raising this concern.
Currently, Rank Math does not automatically parse shortcodes when calculating SEO scores and providing suggestions. However, you can use a filter to modify how Rank Math processes content, including shortcodes.
You might want to consider using the rank_math/seo_score filter to adjust the SEO score based on the output of your shortcodes. Here’s a basic example of how you could implement this in your theme’s functions.php file:
add_filter( 'rank_math/seo_score', function( $score, $post ) {
// Check if it's a WooCommerce product
if ( 'product' === get_post_type( $post ) ) {
// Get the content and process shortcodes
$content = apply_filters( 'the_content', $post->post_content );
// Add your logic to calculate score based on the processed content
// For example, increase score if certain conditions are met
}
return $score;
}, 10, 2 );
This code snippet checks if the post type is a product and then applies the the_content filter to process any shortcodes in the product description. You can then add your logic to adjust the SEO score based on the processed content.
Please note that implementing custom code requires some familiarity with PHP and WordPress development. If you’re not comfortable with this, we recommend consulting with a developer.
If you have further questions or need assistance, feel free to reply to this ticket, and a human agent from the Rank Math Support team will assist you further.
Thank you for your understanding!
Sources:
The #1 WordPress SEO Plugin in 2024 – Rank Math
Configuring “Schema Markup” in Rank Math » Rank Math
Hi again,
thanks for your timely response.
However, it seems that the mentioned filter only allows me to post-process the SEO-score that Rankmath calculated. That is not what I want. Instead, I am looking for a filter that forces Rankmath to apply shortcodes to the_content before calculating its own SEO-score. The reason for that is that applying shortcodes can add text passages to the_content, for instance a product description, and that will have influence on the SEO-score based on the overall content wording.
Thanks, Maria
Hello,
Thank you for contacting us. We apologize for any inconvenience this issue may have caused.
Since you are adding the content using shortcodes on the default editor, Rank Math may not be able to access the content of the shortcode from the edit area. The shortcodes are not fully parsed in the edit area but on the live page.
So you can simply ignore the tests as the SEO score is only for your reference and will not affect your site’s SEO performance.
Rank Math should be able to read and calculate SEO scores as long as the content is stored under the post_content meta of the post.
We hope this helps. Please let us know if you have further questions or concerns.
Hey Ike,
thanks for your response. However, part of Rankmaths mission (as I understand it) is to guide me through SEO best practices. But half of Rankmaths suggestions are false-positives, when Rankmath isn’t able to consider shortcode content. But I do understand, how shortcodes (requiring php to execute) can’t be considered, when Rankmath calculates suggestions purely in Javascript while I am still editing the product. I guess, I have to move away from using shortcodes alltogether. Hopefully, the “New product editor” is soon taken out of beta, so I can use blocks in the product description without having to use shortcodes.
Again thanks for pointing this out to me.
Best, Maria
Hello,
Thank you for your detailed feedback and for sharing your experience with Rank Math.
You’re absolutely right that using shortcodes can sometimes lead to false positives in the SEO analysis, as our content parser currently doesn’t execute shortcodes in real-time within the editor.
Please feel free to create a new forum topic if you do have another question in the future.
It will be our pleasure to assist you again.
Thank you.