SEO Titles & Meta – Global Product Title & Descriptions Not Working

#37633
  • Resolved Joe
    Rank Math free

    Hi team,

    Setting global product title and descriptions is not working as intended! If I add a product short description, that overrides my global SEO title and description setting.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Joe
    Rank Math free

    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

    Joe
    Rank Math free

    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;
    });
    Michael
    Rank Math free

    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

    Joe
    Rank Math free

    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.

    ​​​​​​

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this ticket.