THE ANSWER
Well as it happens many times in my life – i found the answer myself.
For people who struggles as me here the answer:
$post['errors']['field_name']['errors'][] = __('Error text here.');
if you do that – error text will be displayed at the bottom of that field. In my case this doesn’t work because i’m using inline media uploader, but with standard WP media uploader (the popup version) it’s working just fine.
BTW best article about custom fields is here: http://net.tutsplus.com/tutorials/wordpress/creating-custom-fields-for-attachments-in-wordpress/
Related Posts:
- Add validation and error handling when saving custom fields?
- Remove Dimension from wp_get_attachment_image
- explode array within shortcode
- How can I append custom data to images in the editor?
- How can I remove fields in the attachment editor?
- Saving Custom Field in Attachment Window in WordPress 3.5
- Correct Approach for Validating Custom Field Input
- Add multiple images to a page sidebar
- How to set a default meta value for custom field
- Add custom field to image editor
- How to save custom fields for attachments
- How to make custom comment fields required and message field not required
- Display info from custom fields in all images’ HTML
- How to reload the role specific registration form on validation errors?
- copy attachments to another post type and change attachment url
- ajax delete value from custom field array
- Save attachment custom fields on front end
- Insert attachment ID in custom field from media uploader
- How to validate custom field on lost password form before the user id field?
- How can I store a file in the database in the same way WordPress and ACF do?
- Getting the ID of any image for use in functions.php
- How do i save and retrieve custom attachment meta?
- Custom field not updating when value is empty
- how to upload a image from frontend with wp_insert_post and also update_post_meta?
- Link FROM attachment to full post and get custom fields values on attachment page?
- Warn user that data may be lost for custom pages
- Attach images to posts using custom fields (just paths to images already uploaded)
- How to add fields in custom registration form, validate it and aave to db? [closed]
- How to load script conditionally on custom field in wp_postmeta?
- Show custom field on attachment page?
- Save attachment ID instead of URL in custom field
- How to validation for sanitize_URL?
- Making custom meta box required (with error message if not filled in) on Gutenberg
- Shortcode for Custom Field of Media Attachment (to use with Featured Images)
- Custom field in media library not saving, selected() function not adding “selected” to select list input type
- How to delete attachments associated with custom field type when post property changes? [closed]
- How to format the various types of custom fields?
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- Validating custom meta boxes with jQuery results in posts being saved as draft instead of published post
- Adding thumbnails for non-image attachments
- How can I attach files without using a plugin?
- Set post status to draft after validating post meta values in save_post hook
- Is there a way to set default custom fields when creating a post?
- Pre-filling custom fields on New Post
- So much data in postmeta
- Show Custom Comment Fields when editing in admin
- How do I make a custom field choose an image?
- get_post_meta() unserialize issue – returns boolean(false)
- Custom Meta Boxes: Store two values in one repeatable field
- Gutenberg Custom Block
- Up/Down voting system for WordPress
- Custom Meta Field not Working with qTranslate [closed]
- Change content before writing to database
- Problem in custom meta boxes
- Loop through two different sets of custom fields
- Query Problem – Show posts within category ‘x’ that have a custom field between ‘y’ and ‘z’
- Add description text under input field for new profile fields
- Metabox with multiple fields added by user and upload box
- Get all meta keys assigned to a post type
- sort search results by custom fields using dropdown
- WP Custom Fields Metabox Disappears – ACF plugin issue [closed]
- Get all posts that do not have a specific custom field without using a subquery
- How to query posts with certain custom meta data, and output Post data
- Custom Fields Not in Search Results
- How to loop through certain custom field values
- add_action and remove_action if custom field exists
- Extra option in editor
- Can’t get metabox value (a url) returned using WPAlchemy
- How to create a dropdown select of all items in an ACF field group
- Custom post meta field effect on the performance on the post
- Is it possible to create a post from an NextGen Gallery image?
- Getting Custom Fields from WordPress JSON API [closed]
- Add first url to custom field on publish_post
- Use meta_query to get title of associated post
- Limits, not all post are showen when querying for posts by view count
- How to make custom fields respect paragraph breaks
- WordPress set custom field to true, sets all others to false?
- modify wordpress custom field value – strip character if exists
- Sort posts by clicks on download button
- Pass PHP through redirect and custom fields
- MetaBox not saving after empty
- How can I create a profile field group that the user can’t see?
- Custom wpdb query – how to sort post by another table meta_count
- Show Custom Field of Current Page in For Loop
- Custom Field & Gravity Forms [closed]
- Redirect DRAFT Posts to a Custom URL (Custom Field) : Currently 404 Page
- Add a custom field to my custom post type and then get posts which are before the given date in the custom field
- Custom User Dashboard
- Custom meta POST request fired twice when updating a post in Gutenberg
- want to add video upload option for front end user
- Adding fields to attachment – only shows when inserting new attachments
- Saving and using Custom Field in user settings/profile “Checkbox list”
- Override edit_custom_walker.php to conditionally show input depending on menu position
- Change event firing in wordpress
- Custom search with meta fields
- Use custom field value as href
- Custom field for image, not showing image!
- save all acf options in one meta_value [closed]
- Can running a WP-Cron to update_post_meta cause performance issues?
- custom field value is blank or empty