Fix WordPress “You do not have permission to preview drafts”

The WordPress error “You do not have permission to preview drafts.” occurs when WordPress does not see you as being logged in or having sufficient access rights when trying to preview a post.

You may also experience problems with your plugins. Assuming you should have permission to preview posts, it can come up when there is a problem with your WordPress configuration. Alternatively, there may have been a glitch when you logged in.

Cause

The issue seems to be caused by the fact that the preview posts page uses the domain name that visitors to your site see (e.g. http://example.com/your-post-name…), whereas you are logged into the domain name that admins see (e.g.  https://admin.example.com/your-post-name or https://wordpress.com/…).

Since your web browser has login information associated with the admin domain, WordPress assumes that you are not logged in when you try to access your site using the visitor domain, which the “preview posts” page uses.

Solutions and Workarounds

A) Cannot preview drafts in WordPress all of a sudden

Login problems

If you have not made any changes to WordPress recently, it could be that something went wrong when you logged in or logged out last time. Try putting your web browser in private mode or open a different web browser. This way, you will be able to re-login without session or cookie information causing problems. If the problem goes away when using private browsing or on a different browser (or if you don’t have an alternate browser available), then clearing cookies on your web browser and/or restarting your web browser or PC should fix the problem.

Plugin problems

If you recently installed a plugin, try disabling it and see if the problem goes away.

B) WordPress.com bug

If your blog is hosted on WordPress.com (i.e. you are not using a custom installation on your own web host), you should rather contact WordPress.com support. This issue has appeared temporarily in the past, but was fixed within a few days of being reported. As a temporary workaround, try accessing your blog’s login page directly (for example https://yourblogname.wordpress.com/wp-admin/), rather than the through wordpress.com login page.

C) Unable to preview drafts in new or changed WordPress install

Step 1: Check address settings

If you have just installed WordPress or have recently changed something in your WordPress installation, check your URL settings. Go to Settings > General and compare your WordPress Address and Site Address. Both these URLs should have the same domain and subdomain. The only difference should be that the WordPress Address might include the subfolder where your WordPress files are.

The below picture shows an incorrectly configured address settings. The domain in the picture below is “example.com“, and the subdomain is everything before example.com (the “www“). Notice that the WordPress Address has left out the subdomain (“www“).

The domains are different. This will prevent you from previewing posts.

The domains are different. This will prevent you from previewing posts.

The problem is caused since you are logged into example.com (the domain that admins see), but the post preview redirects you to www.example.com (the domain that visitors see).

Step 2: Make domains the same

Change them both to reflect the domain you want people to see (e.g. http://www.example.com). There is only one difference. If your WordPress files are placed in a subfolder on your server, then the WordPress Address should include the subfolder where your WordPress files have been placed (e.g. /blog). It doesn’t matter if you are using subdomains or domain aliases (e.g. http://www.example.net or http://blog.example.com), provided that your your .htaccess files and index.php are configured correctly.

Below are the corrected settings.

By adding a www to WordPress Address (URL), the domains are now consistent.

Ensure that the domain and subdomain are the same. This applies even if www.example.com is a domain alias.

Important: Double check that you did not make any mistake with the addresses before hitting submit. If you make a mistake (e.g. by entering www.examplee.com), it will disable your WordPress site and you will have to correct these values in the WordPress database manually.

Note: Admins will have to use the domain you specified (e.g. www.example.com) to login. If you want to use a separate URL for admins (e.g. https://secure.example.com), you may need to look for a WordPress plugin to do this or perform some heavy modifications to your .htaccess file.

Step 3 (Optional): Check for broken links

If you have inserted links into blog posts to other parts of your blog, they may still be pointing to the alternate domain name. Go to a few pages or blog posts and check that the links work. If not, you will have to edit the post and reinsert those links. This only applies to links you inserted into posts yourself, not ones WordPress generates automatically (such as author names or gallery pictures).

Still having problems?

If you still have problems, chances are its a plugin causing a problem. Try disabling recently installed plugins.

It may also be incorrectly configured .htaccess files and index.php files. Check that your .htaccess files and index.php files are properly configured.

Tagged with: ,