Please tell me how to resolve this. I do not want my products using the short description for meta tags. Users should be aware that, if they set a global tag that it gets overridden if you enter short descriptions.
Thanks
Solved the issue. This should be standard how things work not via code snippets.
add_action( 'rank_math/frontend/description', function( $generated ) {
if ( ! is_product() ) {
return $generated;
}
global $post;
$desc = RankMath\Helper::get_settings( "titles.pt_product_description" );
$desc = RankMath\Helper::replace_vars( $desc, $post );
return empty( $desc ) ? $generated : $desc;
});
Hi Joe,
What was the fix exactly? To insert this code? If so, where to do it? I have an issue, where the global snippets are not showing on all products.
Kind regards Michael
Michael,
You could add it to your functions.php file of your theme. A better solution would be a child theme. Or an easier solution that I use for code inserts is the WordPress plugin “Code Snippets”.
Paste that code in Code Snippets and choose Run on Front End Only, save and activate. I suspect if you changed any meta info via the product edit screen that would override this code. Test and see.
Hello,
Thank you for contacting Rank Math today.
I am glad that you were able to fix this 🙂 This feature works this way by design, the product short description and manual descriptions will take higher priority than the global settings.
Looking forward to helping you. Thank you.