移除短链接shortlink

WordPress移除短链接shortlink,表现为如这样的

<link rel='shortlink' href='https://wpmore.cn/?p=75' />

html代码,如果想移除这个短链接,特别是已经设置了固定链接的情况下,移除短链接shortlink就尤为重要。

在你的WordPress主题中的 functions.php 文件中加入:

remove_action('wp_head','wp_shortlink_wp_head',10,0);
remove_action('template_redirect','wp_shortlink_header',11,0);

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注