meta description

#689006
  • Resolved Anonymous
    Rank Math free

    hi, I want to change the “meta description” of the products belonging to a certain category and add a word to the beginning of it, how?
    category id: 1665 and 4896
    word: photo of
    my meta description in rank math setting: %excerpt%
    so should be: photo of %excerpt%
    i use woocommerce

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello, I’m sorry to hear about the issue you’re facing with updating the meta description for your products in Rank Math. To add the word “photo of” to the beginning of the meta description for products belonging to categories 1665 and 4896, you can follow these steps:

    1. Navigate to WordPress Dashboard → Rank Math SEO → Titles & Meta → Products.
    2. Scroll down to the Single Product Description field and enter the following: photo of %excerpt%.

    Here’s a visual guide to help you through the process:

    Enter a Single Product Description

    Once you’ve added the description, remember to scroll down and click Save Changes.

    I hope this helps! If you have any other questions or need further assistance, feel free to ask.

    Sources:
    How to Set Product Meta Description Using Rank Math » Rank Math
    How to Optimize a Category Page » Rank Math

    Hello,

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

    You can use the following filter on your website and see if that works for you:

    add_filter( 'rank_math/frontend/description', function( $description ) {
        global $post;
        if(is_product()) {    
            $term = get_the_terms( $post->ID, 'product_cat' );
            $term_id = wp_list_pluck($term, 'term_id');
    	$prduct_categories = array( '1665', '4896');
            if(array_intersect($prduct_categories, $term_id)) {
    	    return 'Photo of '.$description;
             }
        return $description;
        }
    });
    

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

    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.