variable is not working in description

#376567
  • Resolved Faizan Risians
    Rank Math free

    Hi team
    I’m facing an issue with my product description. The variable is not working in the product description field.
    I’m using the same variables in the product title & description. The title variable is working fine but the description variable not working.

    plz, check out the image. You are requested to give me a solution ASAP.

    nullhttps://ibb.co/6XxyTrH

Viewing 7 replies - 1 through 7 (of 7 total)
  • Prabhat
    Rank Math agency

    Hello,

    Thank you for contacting the support and we regret the inconvenience caused.

    The %page% variable is used to display the page number on a paginated series. I checked the URL in your screenshot and it is a product page and not a paginated page. This is the reason why the %page% variable is not outputting any data.

    However, as for the %title% variable, please edit the page and see if you have added a custom meta description from the Snippet Editor: https://rankmath.com/kb/seo-meta-tags/#seo-description-gutenberg

    If yes, please remove it and update the page. Once done, check the source of the page again and see if the meta description updates.

    Let us know how that goes.

    Thank you.

    Hi, Prabhat thanks for your reply, I did as you said but nothing was done. Plz, suggest any other way to fix this issue.

    Anas
    Rank Math business

    Hello,

    Can you please add this code in the theme’s functions.php file?

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

    Here is a guide you can follow to add the filter:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/#functions-php-file

    Let us know if that helps.

    We are here to assist you.

    Hi Anas. we added the code in the functions.php file. But we are getting errors plz see the image which is presenting the error. plz look into this and provide the best solution.

    https://ibb.co/ts2qFJL

    Prabhat
    Rank Math agency

    Hello,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Sorry Prabhat, We don’t share our credentials. if you have any posts or other things that will help us in finding the cause of this issue, plz share with us so that we can fix it.

    Hello,

    We understand the situation.

    From the error in your screenshot, it seems that the code was added incorrectly. However, here’s another way to apply the filter using the rankmath.php file:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    Let us know how this goes.

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

The ticket ‘variable is not working in description’ is closed to new replies.