hook rank_math/frontend/canonical don’t work in mu-plugin

#210456
  • Resolved Altimax
    Rank Math business
    Content AI Creator

    I from france,

    I have a little problem on some page, i want to use hook “rank_math/frontend/canonical” to force canonical, but when i use it in my mu-plugin the filter is not called, i think is called to soon in your plugin.

    My filter is inside a controller like that:

    Filter::add(‘wpseo_metakey’, [$this, ‘_setYoastMetaKeywords’]);
    Filter::add(‘rank_math/frontend/keywords’, [$this, ‘_setYoastMetaKeywords’]);
    Filter::add(‘wpseo_metadesc’, [$this, ‘_setYoastMetaDesc’]);
    Filter::add(‘rank_math/frontend/description’, [$this, ‘_setYoastMetaDesc’]);
    Filter::add(‘wpseo_title’, [$this, ‘_setYoastMetaTitle’]);
    Filter::add(‘rank_math/settings/title’, [$this, ‘_setYoastMetaTitle’]);
    Filter::add(‘wpseo_robots’, [$this, ‘_setYoastMetaRobots’]);
    Filter::add(‘rank_math/frontend/robots’, [$this, ‘_setRankMathMetaRobots’]);
    Filter::add(‘wpseo_canonical’, [$this, ‘_setYoastCanonical’]);
    Filter::add(‘rank_math/frontend/canonical’, [$this, ‘_setRankMathCanonical’]);//don’t work
    Filter::add(‘rank_math/opengraph/url’, [$this, ‘_setYoastCanonical’]);

    All hooks works except for canonical (some client prefer yoast, and it work in this way with it).

    rank_math/opengraph/url work with good canonical.
    For exemple:
    https://www.saintfrancoislongchamp.com/hebergement-collectif/residence-le-roc-noir-saint-francois-longchamp-hiver/
    have normaly for canonical: https://www.saintfrancoislongchamp.com/hebergement-collectif/residence-le-roc-noir-saint-francois-longchamp/

    But your plugin doesn’t want my filter in this place. When i call this filter in the theme, it work because theme (function.php) it called before your execution. but i think you called this hook way too soon, because in my case, the view with the header is not loaded when i set filters. i use themosis 2 by the way, a matchup with Laravel and wordpress.

    best regards,
    Roméo, ALTIMAX

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today.

    That filter belongs to the Paper class in our plugin and runs in the same place as the robots filter and many others that are present in the same class.

    Changing the way this filter is run, or the place where it runs would require us to change some core functionality of the plugin and that is not something that is currently planned as this filter is currently working as intended when used for the purpose it was created initially.​​

    Hope you understand.

    Don’t hesitate to get in touch if you have any other questions.

    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 ‘hook rank_math/frontend/canonical don’t work in mu-plugin’ is closed to new replies.