Execute Shortocde in ‘Add missing ALT attributes’

#149924
  • Resolved Ritesh
    Rank Math free

    Hello,

    I’m using the option ‘Add missing ALT attributes’ that adds the post’s title to the alt tag.

    Now, some of my posts have shortcodes in the title. As a result, RankMath just adds those shortcodes to the alt attribute of the images without executing them first.

    Is there any way to force RankMath to execute those shortcodes?

    Waiting for your response.

    Regards,
    Ritesh Saini

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting the support, and sorry for any inconvenience that might have been caused due to that.

    It seems the shortcode of my post title was executed and displayed in the alt text of my image when I tried replicating your issue on my end. See the video screenshot: https://i.rankmath.com/rlF3CA

    Can you please share the affected URL in the sensitive Data section so we can take a closer look at it?

    If it still seems I am missing something, sharing a screencast from your end would save us all the time in trying to replicate the issue.

    We are looking forward to helping you.

    Ritesh
    Rank Math free

    Hello,

    Thanks for your quick response.

    Default RankMath shortcodes like %example% are working fine. It’s the [example] shortcodes that are not working.

    In the screenshot that I shared, you can see that my post’s title has [year] shortcode that prints the current year on the front end.

    When I use %title% in the alt attribute template, it prints the post title’s [year] as it is, without executing the [year].

    If you still need more info to understand the situation, then please let me know.

    Regards,
    Ritesh Saini

    Hello,

    Thank you for the follow-up.

    The screenshot you have provided seems to be the preview, that’s why it is showing the shortcode. Could you please also share some affected URLs to check as well in the source code? It seems that you’re using some code in your functions.php that works only when the post is viewed in the browser.

    Thank you, and we really look forward to helping you.

    Ritesh
    Rank Math free

    Hello,

    Thanks for your response.

    I’ve added the affected URL to the sensitive data sections.

    On this page, you can see all the images already have alt tags, but I let RankMath add the title tag to the images.

    You can hover over any image and you’ll see the post’s title with unexecuted shortcode [year].

    Waiting for your response.

    Regards,
    Ritesh Saini

    Hello,

    Rank math may not print the shortcode content in the field as intended.

    Assuming you want to print the current year, you can us e Rank math’s variable: %currentyear%.

    Let us know if this helps.

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

The ticket ‘Execute Shortocde in ‘Add missing ALT attributes’’ is closed to new replies.