admin管理员组

文章数量:1122832

The preview function works fine when posts are just draft. The url looks like this : /?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 : /?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

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

Share Improve this question edited Aug 22, 2014 at 10:03 0x1gene asked Aug 22, 2014 at 9:56 0x1gene0x1gene 1395 bronze badges 2
  • Do you have any caching on? – Steven Jones Commented Aug 22, 2014 at 11:13
  • @StevenJones no I don't – 0x1gene Commented Aug 22, 2014 at 11:13
Add a comment  | 

2 Answers 2

Reset to default 0

You need to define the %postname% permalink and be sure that the .htaccess is modified.

If your .htaccess has blocked access you can do it manually.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

You can see more info at the Codex, just look for "Using "Pretty" permalinks".

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 ?

本文标签: publishI can39t preview post39s change once they are published