Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
I am afraid that Rank Math does not accept shortcodes on the title or description fields. You can however workaround this by adding some PHP code to your current theme to run the title and description through the do_shortcode() function on specific pages that you want to use the shortcodes.
You will need to make use of the following filters to achieve this:
add_filter( 'rank_math/frontend/title', function( $title ) {
return $title;
});
add_filter( 'rank_math/frontend/description', function( $description ) {
return $description;
});
Here is an example of how you could use the first filter to execute a shortcode on the meta title field:
add_filter( 'rank_math/frontend/title', function( $title ) {
//create some conditional logic here to execute the below for only certain pages/posts
$title = do_shortcode($title);
return $title;
});
I hope this info helps. Thank you.
βββββββ
Wow! I love it. Itβs working now. Thank you so much. Iβm very very happy now. You save my time and day looking for this for plugin.
However, the SEO description field is not working if I put shortcodes in it.
Is there a way to do this?
Also, I want to put shortcodes in the unique URL of the page which display below the post title in search results. For example domain.com/market/[shortcode]/[shortcode]
Also, I’d like to add if I can use shortcodes in the focus keyword. Thank you so much.
To sum it up,
these are the fields I want to use shortcodes of.
1. Seo description field
2. unique URL of the page field
3. focus keyword field
-
This reply was modified 5 years, 7 months ago by Viralalert.
-
This reply was modified 5 years, 7 months ago by Viralalert.
Hi,
Sorry but there is no option to insert the shortcode inside the URL or the focus keyword field.
We already gave you the code for meta description. Is that not working for you?
Thank you so much. Yes, it’s working for the description.
Hi,
I am glad.
If you need help with anything else, please do not hesitate to ask.