Product meta description

#584776
  • Resolved Anonymous
    Rank Math free

    Hello I have 2 questions
    I would like to know if there is any option to add a product description as a product meta description
    Also, will it be okay if I put the focus keyphrase for all the products in the same category, if yes how I can bulk add focus keyphrase
    Thank you in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    Please try applying the following code to force Rank Math to take the product description (long) as your product meta description:

    add_action( 'rank_math/frontend/description', function( $generated ) {
    	if ( ! is_product() ) {
    		return $generated;
    	}
    
    	global $post;
    	$desc = wp_strip_all_tags( $post->post_content );
    	return $desc;
    });

    Note: Although the short description will still be visible in the snippet editor of the meta box, the filter will add the correct product description (long) to the front end. Hence, please check the page source code of your products to verify if it’s working or not.

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

    Also, there is no issue in adding Focus keywords in bulk. Please follow the guide below to lear more on how you can do that:
    https://rankmath.com/kb/how-to-automate-the-insertion-of-focus-keyword/

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

    Anonymous
    Rank Math free

    Thank you, can you please tell me where exactly I should add the code

    Hello,

    The easiest method is to use Code Snippets. This is a plugin that lets you easily add and manage custom code snippets in WordPress without editing any files. You can install the plugin and add a new snippet by following these steps:

    • Go to Plugins > Add New and search for Code Snippets. Install and activate the plugin.
    • Go to Snippets > Add New and enter a title for your snippet. This could be anything that helps you identify the code.
    • Paste the code that we provided to you in the code box.
    • Save the snippet and activate it.

    That’s it. You’ve successfully added the custom code to your site.

    There are also other ways to add code to your site, such as using your theme’s functions.php file or creating a rank-math.php file. We have documented them here: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    We hope this helps you. Please let us know if you have any other questions or concerns.

    Thank you for using Rank Math.

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

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