After some research, I altered my approach to validate the meta values in the following way:
- Create a new meta key(for post type) to store the validation (0 and 1).
- Initiate it with 0.
- This need not be kept/shown in the meta form.
- While saving the meta fields (preferably within
save_post
hook), set its value depending upon the validation. - Use this meta value to detect the validation status of the post. For example you can display/hide the post depending upon this value.
Related Posts:
- Add validation and error handling when saving custom fields?
- Using get_post_meta with new_to_publish
- Correct Approach for Validating Custom Field Input
- How to store the value of a custom field dropdown select for post referencing?
- Get updated meta data after save_post hook
- Check before publishing, if already exist post with current custom field value
- How to make custom comment fields required and message field not required
- How to reload the role specific registration form on validation errors?
- Check if the value of a field has changed on save_post
- How to validate custom field on lost password form before the user id field?
- Validate data on attachment_fields_to_save
- Send email with custom fields after new draft is saved or new post published
- Get updated meta value after post update or published (custom post type) using hook
- custom-meta-box checkboxes from loop won’t save
- Saving Custom Field Data before Publish
- Show user info in a hovercard [closed]
- Allow only one post with specific meta value
- Warn user that data may be lost for custom pages
- What is the proper way to add a required field to a post type? [duplicate]
- Custom metabox not displaying multiselect data in edit mode
- How to validate select field in post meta?
- How to add fields in custom registration form, validate it and aave to db? [closed]
- frontend submit post jQuery clone row won’t save
- Can wp_insert_post_data filter be used to save custom field data?
- How to validation for sanitize_URL?
- Exclude URL’s from sanitize_html_classes
- Making custom meta box required (with error message if not filled in) on Gutenberg
- Use value from ACF to populate other fields
- update a custom field with the value of another existing custom field
- Post meta data not showing in frontend, until hitting ‘update’ button
- How to format the various types of custom fields?
- Why WordPress takes time to make request to save post?
- Saving metadata of related post on save_post
- Validating custom meta boxes with jQuery results in posts being saved as draft instead of published post
- added a meta box to post however when saving menu while debug on throws a warning
- Change post status by custom fields
- Multiple triggers when publishing, saving or updating a post in WordPress
- WP_Query – Order results by meta value
- Custom query with orderby meta_value of custom field
- How to enable revisions for post meta data?
- Any way to add custom options to Gallery Settings?
- Including custom fields in search?
- Sort posts by custom field numeric value using dropdown
- How to position a custom field before the editor
- How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
- passing argument to get_template_part() or a better way to code
- How to add upload field in a custom taxonomy?
- Display thumbnail from custom field
- Bulk move (or copy) from a custom field to the post content?
- Getting Custom Field data from a page hierarchy
- limit amount of photos uploaded per cpt post
- Problem with adding exta field in metabox in custom post type
- Move value of one custom field to another
- little help with a mySQL query to wp database
- Add WYSIWYG to Image Description field
- Calling custom profile fields?
- Show ACF fields only on certain page in the backend
- How to catch and modify custom field values when a page is updated
- Performance of storing multiple meta fields vs one JSON encoded field [duplicate]
- Create Multiple File Upload Metabox in WordPress
- WP_User_Query pulling ACF to loop
- how to put a custom field value in variable
- Custom Metabox Not Saving
- Custom Profile Fields move from BBpress to BuddyPress
- How can I output a list of values for a custom field, and posts with those values?
- Manipulate javascript code from custom made admin page menu
- Validate post checking if child term is assigned
- Add additional ‘description’ field for defined roles / role metadata?
- Change the main loop WordPress impact on the server?
- How to get categories with posts by custom field value?
- WordPress function saves a post twice and updates all posts
- Walker class for sub-menu with ACF fields
- Display custom field value part by part?
- Add custom fields to existing posts (admin pages)
- How do i get the attached images with custom value checked?
- How to disable Edit Post and Allow only Custom Field?
- Convert attachment ID into url?
- Custom Fields Question
- do_shortcode close
- How do I convert all custom_field php timestamps in the database to js timestamps?
- Display custom field value as a mailto: link
- Make separate text boxes for separate WordPress Custom Fields
- remove_action(‘save_post’) in function that was triggered by save post not working
- Custom field metabox not showing in back-end
- Load one page with parent and child pages
- Why can’t I get the correct post permalink
- Use a different catalog image than the featured image
- Login Api with Meta_key and Meta_value
- Ordering posts by custom fields
- How to diplay a div only if at least one author custom profile field is filled?
- Set custom field value when reaching expiration date
- Confusion on how to display custom field data
- How to allow user to add to, but not edit, a post?
- How to organise via Custom Fields on Category Page
- Calling Custom Field within Function wrapped with Divs.
- Display custom field value into content with hyperlink
- how to add radio field on user meta on function.php?
- Custom fields: Split data from single custom field’s sub-array to separate custom fields when saving post
- How can I copy value from dropdown once I select it to text area as text?
- How to add new Metadata options (Date, Author, etc.) for Posts?