我试图在 WordPress 上发布时更改默认的“预览帖子”按钮,因为该网站安装了被黑客入侵的 WordPress,并且帖子预览不在应有的位置。
我找到了钩子preview_post_link
现在我只是想弄清楚如何制作一个小插件来解决这个问题。
我不知道该怎么做,也不知道为什么我在这里发帖,使用add_filter
更改链接
add_filter( 'preview_post_link', 'the_preview_fix' );
function the_preview_fix() {
return;
}
我需要它做的就是不要转到其当前链接,而是转到www.website.com/blog/p/the-slug
即使草稿帖子没有出现在实时网站上,链接仍然会将我带到生成的页面:)
预先感谢您收到的任何和所有帮助
编辑修复它!
add_filter( 'preview_post_link', 'the_preview_fix' );
function the_preview_fix() {
$slug = basename(get_permalink());
return "http://www.mywebsite.com/blog/p/$slug";
}
add_filter( 'preview_post_link', 'the_preview_fix' );
function the_preview_fix() {
$slug = basename(get_permalink());
return "http://www.mywebsite.com/blog/p/$slug";
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)