short description affecting product meta description

#208107
  • Resolved KEKHUB
    Rank Math free

    Hello, I’ve got the problem with my short description of woocommerce products affecting their meta description. I need my short description to be separate from the meta description.

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    I’m not quite sure whether I fully understand your concern. But I’ll do my best, and please let me know if I misunderstood.

    I’m assuming you’re using WooCommerce for your products since you mentioned that the short description is showing instead of the main/long description of your products, and you’re using the %excerpt% variable. Could you please confirm?

    If so, this is the order we follow to generate meta descriptions for WooCommerce products:

    1. Content from SEO Description field
    If that is missing, then:
    2. WooCommerce Excerpt or Product Short Description
    If that is missing, then:
    3. Template From General Settings in WordPress Dashboard > Rank Math > Titles & Meta > Products
    If that is missing, then:
    4. Auto generated Content from the product page (long description)

    To summarize, the short description you have set will be prioritized if you’re using the %excerpt% variable for your description.

    In case you wanted to force the use of the long description, you can create a custom variable for the product’s long description by adding the code given below to your theme’s/child theme’s functions.php file:

    add_action( 'rank_math/vars/register_extra_replacements', function() {
    	rank_math_register_var_replacement(
    		'woo_full_desc',
    		[
    			'name'        => esc_html__( 'Woo Full Desc.', 'rank-math' ),
    			'description' => esc_html__( 'Woo Full Description...', 'rank-math' ),
    			'variable'    => 'woo_full_desc',
    			'example'     => woo_full_desc_callback(),
    		],
    		'woo_full_desc_callback'
    	);
    } );
    function woo_full_desc_callback() {
    	global $post;
    	if ( empty( $post ) ) {
    		return 'Product Description';
    	}
    
    	return wp_strip_all_tags( $post->post_content );
    }

    After this add %woo_full_desc% in the SEO description field of the snippet editor

    I hope that helps.

    Thank you, and please don’t hesitate to contact us anytime if you need further assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘short description affecting product meta description’ is closed to new replies.