1

I have a custom post type for which I would like to disable saving as draft functionality. I don't think about autosave/revisions, just disabling drafts. Only publishing should be allowed.

Also, no CSS and/or plugins should be used.

EDIT:

Basically the reason I wanted to disable post drafts was because drafts don't require all fields to be filled. I need all fields to be mandatory regardless of the post status. If there is any solution for making fields mandatory I would be grateful. It doesn't have to be disabling drafts.

  • To be honest, I've only googled for solution, but nothing I have found was the thing I've needed. Usually answers to questions that already existed where related to auto-save or if it was about the disabling creating drafts the solution was about using CSS/JS. i would put the code but I really don't have anything since I really don't know how to do it. I know how to hide draft button, disable auto-drafts, but it just isn't the solution I am satisfied with. – dodo254 Jun 10 '18 at 10:29
  • 1
    Can you explain why you don't want the draft? Maybe we can offer you a solution that's coming from a different angle. – Bjorn Jun 10 '18 at 10:35
  • I have a custom post type that needs all fields to be mandatory, regardless of the status. The user must not be able to save the post (be it publish or draft) if any of the fields is left empty. – dodo254 Jun 10 '18 at 13:31
  • Then maybe you should edit your question: you don't want to disable the draft status, what you actually want is to make fields mandatory for your custom post type and prevent posts from being saved if any field is left empty., regardless of status. You can probably do this by hooking a conditional check to the 'save_post' hook - this is not an answer, but probably a good direction to look into. – Iceable Jun 11 '18 at 7:50
  • Guys, thank you for your comments. @Iceable, I've edited the question. I'll look into your advice. – dodo254 Jun 11 '18 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.