admin管理员组文章数量:1391934
How can I change the preview URL in Wordpress?
When creating a post in Wordpress, there is a Preview
button which takes you to the draft view. Because I have a custom integration of Wordpress and don't use a theme, I would like to change the URL of the preview link. Is this possible? How?
Regarding the custom implementation, Wordpress posts are integrated in another framework. I do this by setting WP_USE_THEMES
to false
, loading wp-config.php
and directly accessing the posts using WP_Query()
. This means I am bypassing any Wordpress theme that is set.
How can I change the preview URL in Wordpress?
When creating a post in Wordpress, there is a Preview
button which takes you to the draft view. Because I have a custom integration of Wordpress and don't use a theme, I would like to change the URL of the preview link. Is this possible? How?
Regarding the custom implementation, Wordpress posts are integrated in another framework. I do this by setting WP_USE_THEMES
to false
, loading wp-config.php
and directly accessing the posts using WP_Query()
. This means I am bypassing any Wordpress theme that is set.
- 1 You can try the preview_post_link filter: developer.wordpress/reference/functions/… – czerspalace Commented Nov 19, 2018 at 21:07
1 Answer
Reset to default 9You can do something like this, add to functions.php
add_filter( 'preview_post_link', 'the_preview_fix' );
function the_preview_fix() {
$slug = basename(get_permalink());
return "http://www.mywebsite/blog/p/$slug";
}
More info HERE and HERE.
本文标签: wp configHow can I change preview URL
版权声明:本文标题:wp config - How can I change preview URL? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744731434a2622072.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论