Can’t publish custom type posts that don’t support title and editor, instead they’re saved as draft

After thorough investigation, I identified the root cause of the issue.

TL;DR: A bug in my JavaScript code was causing the post form to be submitted without the necessary publish parameter. Consequently, WordPress interpreted the request as an attempt to save a draft. I resolved the issue by updating the code to include the publish parameter upon successful validation of the post’s meta data.

Detailed Explanation:

During post submission, the value of the clicked submit button is transmitted as a parameter. For instance, the “Publish” button’s value is sent as publish: Publish, indicating to WordPress the intended action. If the publish parameter is received and not empty, the post is published.

Delving further, when a post hasn’t been published yet, the post_status parameter defaults to draft. This value is transmitted with the new post regardless of the button clicked for submission. If the publish parameter is present and non-empty, the post_status value changes to publish, marking the post as published in the database. Otherwise, the post remains in draft status.

Upon analyzing the submitted data, I noticed that the publish parameter was missing despite clicking the corresponding button.

Unbeknownst to me, I had implemented JavaScript validation code several months ago to validate post meta data before submission. However, I failed to test this validation logic before moving on to other parts of the plugin. Thus, while validation was indeed preventing form submission, the publish parameter wasn’t added upon successful validation.

casinojojobetpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casinocanlı bahis casino siteleriOnwin Güncel Girişcasinoholiganbet girişholiganbet güncel giriş