Hello,
Thank you for reaching out to us,
You can modify your meta data using the add_filter
function.
You may refer to these guidelines
https://rankmath.com/kb/filters-hooks-api-developer/#metadata
Hope this solves your issue you are facing.
Looking forward to helping you.
Hi,
Actually, I’m trying to convert the %title% to the real title value, like this: Helper::replace_vars( '%title%', $post ) //$post is the post object
. If I use this in the single template, it works fine. However, I want to use this API in the admin, outside the loop. I have checked the source code and found out that the variable $replacements return null: https://i.imgur.com/bGyaTOs.png.
Then I checked the class RankMath\Replace_Variables\Manager. It turns out that the RankMath\Replace_Variables\Manager->setup() is not running, it is hooked into admin_enqueue_script.
Can you give me some advice on this?
Hello,
Are you trying to display this else where other than on Rank math fields?
If so, the %title% variable gets the set title of your post. Instead of having to get this variable then converting it to the post title value, I think it would be easier to just use WordPress function to get post title: get_the_title()
. Here is a link for reference on this: https://developer.wordpress.org/reference/functions/get_the_title/
Hope this helps you. 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.