admin管理员组文章数量:1327843
For first let me introduce what I've already discovered.
I don't know how Yoast calculates the permalink but it's non standard and that fact creates a lot of problems.
There are some filters to force Yoast to use the correct permalink:
add_filter('wpseo_canonical', array(__CLASS__, 'yoast_change_seo_canonical'), 1, 1 );
add_filter('wpseo_opengraph_url', array(__CLASS__, 'yoast_change_seo_opengraph_url'), 10);
add_filter('wpseo_schema_article', array(__CLASS__, 'example_change_article') );
add_filter('yoast_seo_development_mode', '__return_true' );
public static function yoast_change_seo_canonical( $canonical )
{
if ( is_single() )
{
return get_permalink();
}
else
return $canonical;
}
public static function yoast_change_seo_opengraph_url( $canonical )
{
return get_permalink();
}
function example_change_article( $data )
{
//YoastSEO()->context_memoizer;
YoastSEO()->meta->for_current_page()->canonical = get_permalink();
YoastSEO()->meta->for_current_page()->open_graph_url = get_permalink();
}
The last one doesn't work as I would expect.
Any suggestion? I've tried both to change the data in the context / memoizer, but also to use the filters.
本文标签: Yoast and permalink troubleshooting
版权声明:本文标题:Yoast and permalink troubleshooting 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742215017a2434409.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论