• Resolved eddie

    (@ediet)


    Hello,
    I would like to Replace WordPress Excerpt with Meta Description Rank Math.
    I’ve added the code to functions.php:

    function replace_post_excerpt_filter($output)
    {
    $output=get_post_meta(get_the_ID(), 'rank_math_description', true);
    return $output;
    }
    add_filter( 'get_the_excerpt', 'replace_post_excerpt_filter' );

    But in the frontend only some posts have excerpt displayed. I understand it’s only the ones that were done manually.

    Two questions have arisen:
    1) How to make both descriptions appear in excerpt: manually made and automatically generated by Rank Math?
    2) How to add ‘…’ to the end?

    • This topic was modified 1 year, 11 months ago by eddie.
    • This topic was modified 1 year, 11 months ago by eddie.
Viewing 1 replies (of 1 total)
  • Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @ediet,

    Thank you for contacting support.

    You can change the function to check if the description exists otherwise fallback to the settings from our plugin for the posts like so:
    https://pastebin.com/Bw6fKPyN

    This also adds the 3 dots after the output for each one.

    Don’t hesitate to get in touch if you have any other questions.

    • This reply was modified 1 year, 11 months ago by Rank Math Support. Reason: Fixed the code
Viewing 1 replies (of 1 total)
  • The topic ‘Replace WordPress Excerpt with Meta Description’ is closed to new replies.