title: WordPress shortcode for custom post types
body: <p>I am working on a custom WordPress theme and need to call the $title field for each page within the footer. That field needs to be the same as the one I set as SEO title with the RankMath plugin and I solved it using this function:</p>
  <pre><code>add_shortcode('rm_title', 'rm_shortcode_title');
  function rm_shortcode_title(){
      global $post;
      $title = get_post_meta($post-&gt;ID, 'rank_math_title', true);
      return $title;
  }
  </code></pre>
  <p>Now, using the shortcode [rm_title] I can see the SEO title within the footer. However, this only works for classic post types (pages and posts).</p>
  <p>What I am trying to do is to also use this shortcode for custom post types, in particular on post_type=user_ads. I've noticed that when I go into the edit screen, in addition to the post_type, there are several fields in the url. I list them here:</p>
  <ol>
  <li><strong>taxonomy=custom_5662</strong></li>
  <li><strong>tag_ID=480 ( this value changes for each post type )</strong></li>
  <li><strong>post_type=user_ads</strong></li>
  </ol>
  <p>The complete editing url of the individual custom post types has this structure: <strong>https://localhost/wp-admin/term.php?taxonomy=custom_5662&amp;tag_ID=XXX&amp;post_type=user_ads</strong></p>
  <p>I have tried various ways without ever being able to find a working solution, so I am kindly asking for help.</p>
  <p>Thank you in advance for reading this.</p>