I can’t preview post’s change once they are published

The preview function works fine when posts are just draft. The url looks like this :
http://exemple.domain.com/blog/?p=12&preview=true

Then when I pubish my posts, let’s say I want to change something and preview it, the url looks like this : http://exemple.domain.com/blog/my-article-title/?preview=true&preview_id=12&preview_nonce=514e88946a&post_format=standard

The problem is it does reflect any changes …

I use WordPress 3.9.2 running Twenty Fourteen theme without any plugins

EDIT

I’ve turn the permalink to default and it resolve the problem. But I need it to work using the pretty url …
Thanks for your help

2 Answers
2

This is probably not the best way to do it since it wont persist after wordpress updates (but hopefully the update will correct it.

In wp-admin/includes/post.php ,edit the post_preview() function just before returning the apply_filters( 'preview_post_link', $url ); put the following code:

//ORIGINAL
//$url = add_query_arg( $query_args, get_permalink( $post->ID, true ) );

//CHANGES to make the preview work even with postname in the URL
$query_args['p'] = $post->ID;
$url = add_query_arg( $query_args, get_permalink( $post->ID, true ) );
$url = str_replace('%postname%/', '', $url); 
//END CHANGES

But still if there is any way to make it better ?

Leave a Comment