Skip Navigation

[Resolved] Show special 404 message when visiting draft

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 1 reply, has 2 voices.

Last updated by Waqar 2 months, 3 weeks ago.

Assigned support staff: Waqar.

Author
Posts
#1630903

Hi there

On our member platform, users can submit posts (the standard wordpress posts). The posts are saved as drafts and will be published once an admin checked them.

For users, that is confusing, because when they want to visit their new post, they end up on a 404 page (at least until the post is public).

My question is, if it's possible to have a special layout assigned to that particular case, that lets the users know, that their post is in draft mode and not yet published. We already use that feature to inform non-logged in users that they have to log in first to access the content. However, that only seems to be possible for the "Read" capability.

Is there a solution for our case? Maybe in a different way?

Thanks for your help.

#1631601

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

By default, the users with "Author" role and up, can view and edit their posts in the "draft" status, while logged-in.

And likewise, the users with the "Contributor" role can submit and view/edit their posts in the "Pending" status, which an admin can approve later.

But if on your member platform, you're not setting your members as authors of the posts that they submit or members don't have the "edit_posts" capability that is needed to view their own draft posts, then you can use a different workaround.

You can add a new select type custom post field, for example, "Is approved" with your posts, with two possible values; "yes" or "no". All posts when submitted will have the published status, but for this "Is approved" field the default value will be "no".

When admin needs to approve a certain post, this field's value can be set to "yes". And on the front-end, where ever you're showing these posts, you can include a conditional check to only show the post's content, if the value of "Is approved" field is "yes".
( ref: https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/ )

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar