How to put a shortcode of WP in meta description

#21741
  • Resolved Hungry Minder
    Rank Math free

    Hello,

    Thanks for the wonderful plugin.I have a short code where it shows price statistics.

    As I know there a Rank math variables and we can add to meta description section.How can I add my own or WP shortcodes to variable list and use it?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    Thank you for contacting Rank Math today.

    You can allow the addition of shortcodes to the meta description by adding the following snippet to your theme’s functions.php file:

    /**
     * Allow shortcodes in the Meta Data.
     */
    add_filter( 'rank_math/paper/auto_generated_description/apply_shortcode', '__return_true' );

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hello,

    I have added the code in to functions.php.Then I have placed my shortcode in meta description.But it shows the “[short-code”]” not the short code content?

    Thanks

    Please ignore my last reply.I got it to work.Thanks.

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?rate=5#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

The ticket ‘How to put a shortcode of WP in meta description’ is closed to new replies.