I’m trying to change the default “Preview” button when publishing to Wordpress, because the site has a hacked installation of Wordpress installed, and the message previews are not where they are supposed to be.
I found the hook preview_post_link, now I'm just trying to figure out how to make a small plugin that will help solve the problem.
What I do not know how to do it and why I post here using add_filter to change the link
add_filter( 'preview_post_link', 'the_preview_fix' );
function the_preview_fix() {
return;
}
all I need for this, instead of going to its current link, go to www.website.com/blog/p/the-slug, since even a draft message does not appear on a real site, the link will be still take me to the generated page :)
Thanks in advance for any help received.
EDIT IMAGE!
add_filter( 'preview_post_link', 'the_preview_fix' );
function the_preview_fix() {
$slug = basename(get_permalink());
return "http://www.mywebsite.com/blog/p/$slug";
}
source
share