Shortcodes or meta keys for Title & Meta Description

#408366
  • Resolved Kyle Barfuss
    Rank Math free

    I am looking to use functionality to automatically place the Title & Meta description I have on the page via rankmath into the body of the website.

    Is there a shortcode to do this (for example [‘rankmath_title’] or [‘rankmath_metadesc’]) or a meta key I can use to pull these and display them in the body?

Viewing 1 replies (of 1 total)
  • Anas
    Rank Math business

    Hello,

    Thank you for contacting Rank Math.

    You can add the below code to your theme’s functions.php file:

    add_shortcode('rm_description', 'rm_shortcode_description');
    function rm_shortcode_description(){
        global $post;
    	$desc = get_post_meta($post->ID, 'rank_math_description', true);
        return $desc;
    }
    add_shortcode('rm_title', 'rm_shortcode_title');
    function rm_shortcode_title(){
        global $post;
    	$title = get_post_meta($post->ID, 'rank_math_title', true);
        return $title;
    }

    Once done, you can use the [rm_description] and [rm_title] shortcode in the content.

    Hope that helps.

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

The ticket ‘Shortcodes or meta keys for Title & Meta Description’ is closed to new replies.