This is exactly you guys are saying?
Yes, I suppose.
I create page
https://www.example.com/foo
save it as draft, and when I press “Preview” I see it without problems
https://www.example.com/?page_id=4779&preview=true
Then, if I change url for something different, for example
https://www.example.com/foobar
link in for preview became
https://www.example.com/foobar&preview=true
and since then I see 404, because url redirect to https://www.example.com/foobar
I found the piece of code that causes this issue
From line 187:
if ( $posts[0]->post_status == 'draft' ) {
$originalUrl = "?p=" . $posts[0]->ID;
} else {
$originalUrl = preg_replace( '@/+@', '/', str_replace( trim( strtolower($posts[0]->meta_value),'/' ),
( $posts[0]->post_type == 'page' ?
custom_permalinks_original_page_link($posts[0]->ID)
: custom_permalinks_original_post_link($posts[0]->ID) ),
strtolower($request_noslash) ) );
}
}
When I replace this part in lastest version with old code from v 0.7.24 previews of pages works.
Old code:
$originalUrl = preg_replace( '@/+@', '/', str_replace( trim( strtolower($posts[0]->meta_value),'/' ),
( $posts[0]->post_type == 'page' ?
custom_permalinks_original_page_link($posts[0]->ID)
: custom_permalinks_original_post_link($posts[0]->ID) ),
strtolower($request_noslash) ) );
But, also I found out that previews of posts not working with old code.
So with version 0.7.24 I can preview pages, but not posts. And in version 0.7.25 and higher I can preview posts, but not pages.