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