Hello @stevehoo,
Thank you for contacting the support.
You can use this filter to process the Shortcodes on the frontend:
https://rankmath.com/kb/filters-hooks-api-developer/#allow-shortcodes
But the SERP preview in the backend will still show the Shortcode codes because WordPress doesn’t have any function to process the Shortcodes in JavaScript.
Hope that helps.
Thank you for the better explanation. As, I searched and found this filter, added it, but saw no change on the backend and decided it wasn’t working, or not what I needed. I neglected to check on the front.
I hope that my question, your answer and this will aid others who look for the same problem and solution.
My bad, having actually checked to see if it works… It does not.
See https://i.imgur.com/EzlkjTs.jpg

I’ve added to my functions.php
add_filter( ‘rank_math/paper/auto_generated_description/apply_shortcode’, ‘__return_true’ );
But still seeing shortcodes in my descriptions.
-
This reply was modified 9 months, 2 weeks ago by
stevehoo.
This has worked for me:
add_filter( 'rank_math/frontend/description', function( $description ) {
return strip_shortcodes($description);
});
And… This is much better, as it strips the shortcode, but leaves the content inbetween.
add_filter( 'rank_math/frontend/description', function( $description ) {
$description = preg_replace("~(?:\[/?)[^/\]]+/?\]~s", '', $description);
return $description;
});
And, in the furtherance of science, as I didn’t find it elsewhere. The yourls shortner, shortlink
add_filter( 'rank_math/opengraph/url', function( $url ) {
global $post;
$og_url = get_post_meta($post->ID, '_yourls_url', true ); // Change post_meta_key with your the meta key from your site.
if ( ! $og_url ) {
return $url;
}
return $og_url;
});
Hello @stevehoo
Thank you for sharing all these snippets with us.
We have forwarded them to our content team and requested them to add these to our website.
If there’s anything else we can help you with, please let us know. We are here to assist.