bastelhalde.de


Ben,

Wordpress Error "You do not have permission to pre

error As you may have noticed this block can be reached via two URLs. In the options panel Wordpress wants to know where it lives (Option_ WordPress Address_) and how it can be reached by regular visitors (Option Site Address). I have set up everything correctly but faced one problem when I tried to preview posts. It always gave me the error "You do not have permission to preview drafts." This happens because we log on to the admin panel via the _Wordpress Adress URL _but when you click the "Preview" button in the editor you will be redirected to the URL defined in the _Site Address _Option. You are not logged in on this site so I think this is the origin of this error. The problem can be fixed quick and dirty by editing the "post.php" file in your "wp-admin" directory. Just find the following lines:

case 'preview':
        check_admin_referer( 'autosave', 'autosavenonce' );

        $url = post_preview();

        wp_redirect($url);
        exit();
        break;

Now add one more line which replaces the url you will be redirected to.

Read the comment!

case 'preview':
        check_admin_referer( 'autosave', 'autosavenonce' );

        $url = post_preview();

        //add this line and replace SITE_ADDRESS and WORDPRESS_ADRESS with the right values for your setup
        $url = str_replace(SITE_ADDRESS, WORDPRESS_ADDRESS, $url);

        wp_redirect($url);
        exit();
        break;

For example the _Site Address _for this blog is "blog.bastelhalde.de" and the _Wordpress Adress _is "helios.wh2.tu-dresden.de/~benni_koch/blog".

Please keep in mind that whenever the post.php file is updated you have to redo the changes! This is no permanent solution but a quick way to preview your posts again. Also please remind that this error can have other causes than a wrong redirection. But if your Wordpress Adress differs from your Site Adress it is very likely that you are affected by this because of it.


Leave Comment: