Prospective bug with filter rank_math/frontend/keywords

#692668
  • Resolved Australias Guide
    Rank Math free

    Hello
    Thanks for a fine plugin.
    I would like to report what seems to me to be a bug with the filter ‘rank_math/frontend/keywords’.

    When adding keywords via this filter they do not appear in the head meta tag.
    The tag only shows the saved keywords from the postmeta field ‘rank_math_focus_keyword’.
    <meta name=”keywords” content=”[only postmeta value no filtered keywords]”>

    Note that I have set add_filter(‘rank_math/frontend/show_keywords’, ‘__return_true’) and can see the meta keywords tag if the postmeta field has been set. So the meta tag does work.

    Looking at the code in RankMath\Paper the get_keywords() function immediately returns the cached $this->keywords from the postmeta before it has set the filtered value.

    Note also the code documentation says its expecting an array for $keywords. But it is a comma separated string.

    /**
    * Allows filtering of the meta keywords.
    *
    * @param array $keywords The meta keywords to be echoed.
    */
    return $this->do_filter( ‘frontend/keywords’, $this->keywords );

    Cheers
    Wayne David Harris

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for reaching out to us and for bringing this issue to our attention. We apologize for any inconvenience this may have caused.

    We appreciate your detailed report about the behavior of the ‘rank_math/frontend/keywords’ filter. We will investigate this matter further to determine if there is a bug with the filter and its expected behavior.

    In the meantime, we recommend using the ‘rank_math/frontend/show_keywords’ filter to display the keywords meta tag on your website. As you mentioned, this filter does work, and the meta tag is displayed when the postmeta field has been set.

    We will review the code and documentation as per your feedback and make any necessary adjustments to ensure that everything aligns with the expected behavior.

    If you have any further questions or need assistance, please feel free to ask. Thank you for your understanding and patience as we look into this matter.

    Kind regards.

    Sources:
    How to Add Keywords to WordPress » Rank Math
    How to Automate the Insertion of Focus Keyword » Rank Math
    How to Make Your Theme Rank Math Compatible » 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.

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

The ticket ‘Prospective bug with filter rank_math/frontend/keywords’ is closed to new replies.