How to Fix the “Sorry, You’re Not Allowed to Preview Drafts” Error » Rank Math


Are you looking to fix the “Sorry, you’re not allowed to preview drafts” error?

Previewing your posts or page drafts in WordPress is crucial, as it allows you to spot design flaws, missing components, and spelling or grammatical errors before publishing them.

But without the right permissions, you’ll be unable to preview the drafts.

 Not Allowed to Preview Drafts Error

Fortunately, fixing this issue is straightforward, unlike most WordPress-related errors. But before we resolve this issue, let’s first understand why you’re getting the error message when previewing drafts in WordPress.

1 Why You’re Getting the “Sorry, you’re not allowed to preview drafts” Error

In WordPress, the “Sorry, you’re not allowed to preview drafts” issue occurs when the user who wants to preview the draft has different user roles and permissions than the author.

WordPress uses nonces to verify that the correct user made a request. A nonce is a unique security token WordPress generates to confirm that an authorized user performs a specific action. 

When a user attempts to preview a draft in WordPress, the system generates a nonce to verify their identity and ensure they have the necessary permissions to access the draft.

2 Fixing the “Sorry, you’re not allowed to preview drafts” Error

Use the below methods to fix the error so you can easily preview drafts in WordPress.

2.1 Change User Roles

WordPress has several user roles: Administrator, Editor, Author, Contributor, and Subscriber. Each user role has different capabilities and permissions, determining users’ actions on the site.

The first step to fixing the error is to check whether you have the right user role and permissions to preview drafts. You can only preview the draft if you have the necessary permissions.

2.1.1 Check User Role and Permissions in WordPress

To check your user role and permissions, navigate to Users → All Users from your WordPress dashboard and look at the role assigned to your account.

Check user roles

If you have a user role like Contributor and Author, you may not have permissions like publishing posts or previewing drafts.

You need to change to a higher role, like an Administrator, to fix the error.

2.1.2 Changing User Roles

To change the user roles, click the Edit link of the particular username, as shown below.

Edit the Username

Select Administrator from the Role drop-down menu.

select role

Next, click the Update User button at the bottom of the page to save your changes.

Note: Giving admin access to your WordPress site grants complete control over your website, including the ability to modify, create, or delete content, plugins, themes, and users. Hence, you must be cautious while granting admin access to your team or organization.

2.2 Delete the Preview ID and Nonce from the URL

If you’re not logged into your WordPress user account and try to access the page URL using the preview link, you may also receive the error message “Sorry, you are not permitted to preview drafts.”

You must clear the nonce and post the preview id from the URL to fix the issue.

https://rankmath.com/open-graph/?preview_id=886034&preview_nonce=7f61dddba1a48&preview=true&_thumbnail_id=6040

Delete the characters’ string after the trailing slash and reload the page.

2.3 Enable Public Preview

If you are the administrator, you don’t want to give every user admin privileges to fix the error. 

But you can let other users preview the drafts before publishing them. You can achieve this by enabling the public preview option using a WordPress plugin like the Public Post Preview. The plugin allows users with or without a user account to preview post drafts before you publish them.

To install the plugin, navigate to the Plugins → Add New section from your WordPress dashboard. Search for the plugin in the search bar, and install and activate the plugin.

Public Post Preview plugin

Once you’ve installed and activated the plugin, return to your post queue and select one of the drafts you want your users to preview.

Edit post

Next, under the Post tab, select the Enable public preview checkbox. This will generate a link to your post draft. Copy the link to your clipboard and share it with your team so that they can preview the post.

Enable public preview in post

This allows anyone in your team to preview your post draft regardless of whether they have a WordPress user account or not.

3 Conclusion

Encountering the “Sorry, you’re not allowed to preview drafts” error can be frustrating, but it’s easy to resolve the problem.

To fix the error, ensure you have the right WordPress user role permissions to preview drafts. If your user role is Contributor, you can upgrade to Administrator or Editor. You can also use the Public Post Preview plugin to let other users preview drafts without upgrading their WordPress account roles.

So, did the post help you fix the issue? Let us know by Tweeting @rankmathseo.





Source link

Social media & sharing icons powered by UltimatelySocial
error

Enjoy Our Website? Please share :) Thank you!