So here’s what I ended up doing: I hide the publish button, replace it with my own publish button (one that does not submit the form) and when you click that button the validation script is executed. When there are no errors, a click event is registered on the original publish button. That way, no more drafts and problem solved.
Related Posts:
- Validating Custom Meta Box Values & Required Fields
- Add a Jquery Datepicker to custom field in post edit
- Arrange custom fields with drag and drop?
- Convert jQuery Datepicker Format to SQL Date Format
- Correct Approach for Validating Custom Field Input
- How to make custom comment fields required and message field not required
- How to reload the role specific registration form on validation errors?
- ajax jquery update custom field meta value front end
- sort search results by custom fields using dropdown
- How to validate custom field on lost password form before the user id field?
- Validate data on attachment_fields_to_save
- jQuery – Automatic event trigger does not **really** check my form
- Adding auto-complete to custom gravity field not working
- How to populate custom field dropdown box based on prior selection?
- Uploading PDF using Media Uploader
- Show user info in a hovercard [closed]
- Warn user that data may be lost for custom pages
- How to use media upload on metabox post page without breaking TinyMCE?
- How to add fields in custom registration form, validate it and aave to db? [closed]
- WordPress colorpicker save both hex and RGB
- How to validation for sanitize_URL?
- How do I convert all custom_field php timestamps in the database to js timestamps?
- Jquery on custom-field backend
- Trying to implement AJAX into my admin pages. Am I improperly enqueue and localizing my scripts?
- Meta field bulk editing no longer working in WP 6.0 [closed]
- Making custom meta box required (with error message if not filled in) on Gutenberg
- How to save multiple custom user profile fields using repeater JQuery
- How to format the various types of custom fields?
- Get custom fields when hover link of post
- CSS conditional on custom field value
- show custom field content in jquery tabs
- Set post status to draft after validating post meta values in save_post hook
- Email validation using jQuery
- Validate date in dd/mm/yyyy format using JQuery Validate
- What is jQuery Unobtrusive Validation?
- jQuery Form Validation before Ajax submit
- Check if inputs are empty using jQuery
- Advanced Custom Fields: how do I check to see if a value is set in an field? [closed]
- WP_Query – Order results by meta value
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- getting all values for a custom field key (cross-post)
- How to add a custom field in the advanced menu properties?
- Custom query with orderby meta_value of custom field
- How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?
- Using meta query (‘meta_query’) with a search query (‘s’)
- Can I exclude a post by meta key using pre_get_posts function?
- Add validation and error handling when saving custom fields?
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Most efficient way to add javascript file to specific post and/or pages?
- Show Custom Fields in Quick Edit
- Where are custom field values stored in the database
- Max length of meta_value
- Add custom fields to wp native gallery settings
- How to fix missing custom fields after upgrading to WordPress 4.8.1?
- don’t publish custom post type post if a meta data field isn’t valid
- How to enable custom fields for pages (if not a bad practice)?
- How can I add extra attribute in the ‘Page Attribute’ section in wp-admin for pages?
- Is there a way to set default custom fields when creating a post?
- Custom post meta field effect on the performance on the post
- How to get custom post meta using REST API
- Custom field/meta populated by dropdown of existing posts?
- Difference between meta keys with _ and without _ [duplicate]
- Is there any action filter/hook for validating a custom field before publishing the post?
- Remove Dimension from wp_get_attachment_image
- Orderby meta_value only returns posts that have existing meta_key
- Underscores in custom fields
- What is the index [0] for on post meta fields?
- What is “meta_input” parameter in wp_insert_post() used for?
- Query Posts or Get Posts by custom fields, possible?
- How to validate custom fields in custom post type?
- How to enable revisions for post meta data?
- Sortable Custom Columns in User Panel (users.php)?
- Any way to add custom options to Gallery Settings?
- The “_encloseme” Meta-Key Conundrum
- ORDER BY custom field value
- Individual Widgets per Page
- Add subtitle to Woocommerce product title
- Best way to programmatically remove a category/term from a post
- Importing data for advanced custom fields plugin?
- Gutenberg add a custom metabox to default blocks
- SQL Query to copy value of a meta_key into another meta_key
- ‘Preview Changes’ for custom meta boxes?
- Adding a custom field to the site identity menu
- Using TinyMce with textareas in meta boxes on custom post types
- Filter WP_Query for posts having a certain meta-value
- How to correctly call custom field dates into a posts_where filter using SQL statements
- Using get_post_meta with new_to_publish
- Is there a way to get protected meta fields through any of the available built-in WordPress APIs? (xmlrpc, wp-json)
- add meta box – custom field : which to choose?
- Preserving line breaks when saving and displaying custom fields data
- How to return Meta data from the REST API?
- Advanced Custom Fields – Get custom fields from parent page
- Can I query custom meta data through WP_Query
- Add custom field to the archive page?
- Saving custom data for each user
- Is it safe to store a user setting you don’t want the user to ever modify as a user option?
- Tabindex on text input immediately after WordPress title input
- Including custom fields in search?
- Add custom fields to search
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999