Rank Math fields to .md

#1110661
  • Hi!

    I would like to ask for a piece of code for my markdown.md version posts/pages.
    The case is that I have two versions of my posts/pages – one is html, second is .md
    With this piece of code: $markdown_content .= ‘**Author:** ‘ . get_the_author_meta( ‘display_name’, $post->post_author ) . “\n”; I am able to get the name of the post author and show it on .md version of any post.
    I would like to do the same with some of the Rank Math fields.
    Would you be so kind to provide me with the same code but to get content from these Rank Math fields:

    title
    description (from post meta)
    robots
    og:title
    og:description
    og:url
    og:site_name
    article:publisher
    article:author
    article:section
    og:image
    og:image:alt
    description (from local SEO)

    I would appreciate your help.

    Kind regards,

    Greg

Viewing 1 replies (of 1 total)
  • Hello,

    We apologize for the issue you are facing. Thank you for raising your concern regarding the integration of Rank Math fields into your markdown version of posts/pages. Below is a piece of code that you can use to retrieve the specified Rank Math fields and append them to your $markdown_content variable:

    $markdown_content .= '**Title:** ' . get_post_meta($post->ID, '_rank_math_title', true) . "n";
    $markdown_content .= '**Description:** ' . get_post_meta($post->ID, '_rank_math_description', true) . "n";
    $markdown_content .= '**Robots:** ' . get_post_meta($post->ID, '_rank_math_robots', true) . "n";
    $markdown_content .= '**OG Title:** ' . get_post_meta($post->ID, '_rank_math_opengraph_title', true) . "n";
    $markdown_content .= '**OG Description:** ' . get_post_meta($post->ID, '_rank_math_opengraph_description', true) . "n";
    $markdown_content .= '**OG URL:** ' . get_post_meta($post->ID, '_rank_math_opengraph_url', true) . "n";
    $markdown_content .= '**OG Site Name:** ' . get_post_meta($post->ID, '_rank_math_opengraph_site_name', true) . "n";
    $markdown_content .= '**Article Publisher:** ' . get_post_meta($post->ID, '_rank_math_article_publisher', true) . "n";
    $markdown_content .= '**Article Author:** ' . get_post_meta($post->ID, '_rank_math_article_author', true) . "n";
    $markdown_content .= '**Article Section:** ' . get_post_meta($post->ID, '_rank_math_article_section', true) . "n";
    $markdown_content .= '**OG Image:** ' . get_post_meta($post->ID, '_rank_math_opengraph_image', true) . "n";
    $markdown_content .= '**OG Image Alt:** ' . get_post_meta($post->ID, '_rank_math_opengraph_image_alt', true) . "n";
    $markdown_content .= '**Local SEO Description:** ' . get_post_meta($post->ID, '_rank_math_local_seo_description', true) . "n";

    This code will fetch the respective Rank Math fields and format them for your markdown content. Please ensure that you replace $post->ID with the appropriate post ID if necessary.

    If you have any further questions or need additional assistance, feel free to reply to this ticket. A human agent from the Rank Math Support team will be happy to help you further.

    Kind regards!

    Sources:
    Rank Math SEO Filters and Hooks for Developers – Rank Math

    This is an automated reply from Rank Math Support Bot. If you need further assistance, please reply to this topic and a human support agent will reply to you shortly.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.