Hello,
Thank you for contacting the support and sorry for any inconvenience that might have been caused due to that.
You can use the following filter to change the description. Make sure to paste the code inside your theme’s function.php file.
/**
* Allow changing the meta description sentence from within the theme.
*
* @param string $description The description sentence.
*/
add_filter( 'rank_math/frontend/description', function( $description ) {
$description= "custom description";
return $description;
});
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
hi . thank you for you fast response .
no bro this code notworking for show post seo description in a php custom page
when we edit snippets on a post , and insert a custom description for google , the wp function = the_excerpt() , not showing that custom description in snippets
i want for example echo that description on snippets
like = <?php echo %seo_description%; ?> for example
or
echo do_shortcode(‘[seo_description]’);
Hello,
Thank you for your reply.
You want to display the description of your WordPress post inside other than the WordPress environment, I am afraid the filter code I mentioned to you is just limited to WordPress.
Hope that helps. Thank you and please don’t hesitate to contact us if you need further assistance.
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.