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.
In the order you have shared, you may 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;
});
Here’s how you can add filters/hooks to your WordPress site:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope that helps.
Thank you.
Thank you! But I formulated the necessary priority settings a little incorrectly. It should be like this:
- SEO description
- Single product description
- Product short description
- Product description
I tried adding an additional condition to the filter from the article https://rankmath.com/kb/how-to-set-product-meta-description/. Now it looks like this:
add_action( 'rank_math/frontend/description', function( $description ) {
global $post;
$desc = RankMath\Post::get_meta( 'description', $post->ID );
if (( is_product() ) && ( empty($desc) )) {
$desc = RankMath\Helper::get_settings( "titles.pt_{$post->post_type}_description" );
if ( $desc ) {
return RankMath\Helper::replace_vars( $desc, $post );
}
}
return $description;
});
and works fine, so thank you again!
Hello,
We are glad that you are able to resolve your issue and thank you for sharing the refined version of your code.
Don’t hesitate to get in touch with us if you have any other questions.
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.