meta description

#1094967
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello, we’re sorry to hear that you’re facing an issue with your meta description. To assist you better, could you please provide more details about the specific problem you’re encountering? If it’s related to your website, including the URL would be helpful as well. Thank you for raising this concern!

    Hello,

    Thank you for contacting Rank Math support.

    If you want to use the long description (product description) as your meta description, then you’ll have to create a custom variable for the product’s long description by adding this filter on your site:

    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 );
    }
    

    Here’s how you can add a filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    After this, you can apply the shortcode globally using the %woo_full_desc% variable in the SEO description or single product description field in Rank Math > Titles & Meta > Products.

    https://imgur.com/Y3xAwfO

    Please note that the filter may not be visible while editing the products, as it only works when your products load in a browser. You can check the published/saved product’s meta description via its source code.

    The character limit will not apply when you check the source code; however, the limit will be applied in search results.

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    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 2 replies - 1 through 2 (of 2 total)

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