Skip Navigation

[Resolved] 404 on Preview of Draft CPT

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by mayurJ 6 years, 2 months ago.

Author
Posts
#1102645
custom-role.png
logged.png

I am trying to: Let the owner of a CPT (who is using a custom role) preview their CPT which has Draft status

Link to a page where the issue can be seen:
hidden link

I expected to see:
The draft version which the admin account CAN see

Instead, I got:
404 error

This is EXACTLY the error I'm having: https://wordpress.stackexchange.com/questions/283510/custom-post-type-draft-preview-goes-to-404

Basically, if the admin tries to preview a Draft CPT, it's allowed. But if the owner of the CPT - who is not admin - tries to preview the same draft post, the URL is redirected (as described in the stackexchange article) and 404 is shown.

I have drilled it down to the public_queryable variable. I'm guessing this is the primary issue? That Draft posts can't be public_queryable (unless you are admin)? Can this variable be changed on all of my existing CPTs?

#1103250

Within Toolset Types you can alter several settings of the Post Types you register with it.
These are found in Toolset > Post Types > your_post_type > Edit > Options.

There are as well options to make the post type public, hidden or queriable/not.

However, if this is a Custom Post Type that is not made with Toolset, then we cannot assist the issue - as Toolset would not be required to produce the error.

You seem to use Access.
When you disable Access, the issue probably is not happening as you likely use Access Custom Roles?

I see however that Access is set to preview posts only for:
[0] => administrator
[1] => editor
[2] => shop_manager
[3] => wpseo_editor
[4] => wpseo_manager
[5] => author
[6] => contributor

Are you positive that the role in question has "Preview any" rights in Toolset Access over the Post type?

Please elaborate on the steps we need to take to make the issue happen, then we can try to solve it faster.

#1103321

Somehow, I missed going into Access and setting my CPT to "Managed by Access". After that, I checked the checkbox "edit own" in Access for that custom role. I also checked "Preview any" in Access also. Those were the only two options that I selected.

It's now working perfectly. Thank you.