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

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