Yes, you can add fields, an example
function rt_image_attachment_fields_to_save($post, $attachment) {
// $attachment part of the form $_POST ($_POST[attachments][postID])
// $post['post_type'] == 'attachment'
if( isset($attachment['rt-image-link']) ){
// update_post_meta(postID, meta_key, meta_value);
update_post_meta($post['ID'], '_rt-image-link', $attachment['rt-image-link']);
}
return $post;
}
// now attach our function to the hook.
add_filter("attachment_fields_to_save", "rt_image_attachment_fields_to_save", null , 2);
see more on this post
Related Posts:
- Change upload directory on custom plugin page
- WP Rest API – Upload media without saving attachment post
- Disable resizing of gif when uploaded
- WordPress 3.5+ upload tool filter
- How to check if “media_send_to_editor” is audio?
- Pass parameter to the upload_dir filter
- Allow EPS file upload – two EPS files have different MIME types
- Move a file from a directory to another
- Using wp_handle_upload() to Direct Specific Path by Using $overrides
- upload_files cap to not loggen in users – add_cap to not logged in users
- wp_upload_bits Upload Specific Sizes Only
- Upload restrictions – upload_mimes – filter: Adding multiple MIMEs for a single extension and adding multiple extensions for a single MIME type?
- Filter causing loss of _wp_attachment_metadata
- Filter Media by attached page or blog post in Library
- Show uploaded pdf files dynamically and filter by month name
- Overriding Generated Attachment Post URL
- How to get to the date of the uploaded file
- Post Type Upload Directory – {post_type}_upload_dir filter
- what is __return_false in filters
- How to filter users on admin users page by custom meta field?
- Passing Additional Parameters to add_filter Callable
- How can I add an Author filter to the Media Library?
- Modify WordPress Rest Api Request/Response
- How to add some custom HTML into wordpress admin bar?
- Limit Media Library to Given Folder
- hook into completed image upload filter
- apply_filters(‘the_content’, $content) alternative
- How to use the_excerpt in a filter hook?
- Add wrapper to only youtube videos via embed_oembed_html filter function
- Hook into admin post list page
- Where is the proper place to add a filter for pre_get_table_charset?
- Change text of Description in Image Library
- Allowing non-latin characters in registration
- post_row_actions filter is not working while update post using quick edit
- Using attachment_fields_to_edit filter inside plugin class
- Should I use add_action(‘publish_post or add_filter(‘publish_post?
- How to always display a specific post from the search result first
- get_the_excerpt() with fallback like the_excerpt()
- Taxonomy Custom Column – ‘manage_{TAXONOMY}_custom_column’ filter only passing 2 arguments
- Filter Gutenberg Blocks Content
- Can you use add_filter() inside other function?
- How do I replace a render_callback function for a block?
- check if FILTER(“the_content”) is being executed in `the_post()`
- Change Password Strength Indicator names?
- Filter my args by the post 1st letter
- Limit RSS feed to previous calendar month
- Adding Filter to Homepage only
- How to stop wrapping comments in P tag
- How to modify core when there is no hook?
- Is this the proper way of switching the “Edit My Profile” link with my BuddyPress “Extended Profile” link?
- Does auto_update_plugin Filter Work When Put In Theme’s functions.php File
- In need of a content replace filter for posts in a specific wordpress category
- html tags in gettext hook get escaped
- How to remove action with slashes and arrows?
- Inline Styles on all native blocks
- How to filter post content and force every link () made in blocks to return urldecode() with readable value?
- Set default terms for new posts / CPTs
- Get .subsubsub count of post per status queried using pre_get_posts
- Adaptive product filters for WooCommerce
- Changing WordPress core without hacking core
- Link to Shop-Filter with .current-menu-item
- Plugin options, presets and filters : can you help me improve my workflow?
- Remove posts inside pre_get_posts using a custom query
- Remove / Hide Attachment Display Settings in Add Media popup / dialog
- Wrapping my head around add_filter
- Is it possible to apply filter to meta key value when querying posts?
- How to add_filter to an OOP based apply_filter(‘foo::bar’, $a);
- apply_filters with multiple args and multiple add_filter
- Help with filter for wp_notify_moderator()
- Change custom post type GUID in RSS
- Conflict calling an add_filter() twice
- Filter for author list in gutenberg core editor
- Add something after a filter
- Add filter unless it is being called under specific function
- paginate_links() Change the order of links
- Filter / add_action to upgrade.php page
- Add Filter – Pass Variable (PHP < 5.3)
- Problem width wp_insert_post_data and Gutenberg block editor
- style_loader_tag not changing stylesheet to preload
- add_filter doesn’t return false?
- How to track a particular page in order to address the loading speed issue
- Right filter for rewriting page statuscode
- Changing title using filter not working with argument
- Archive Widget – Count only parent posts
- how to overwrite next_post_link
- Cutting off excerpt with first sentence
- Change URLs in default WordPress slider to relative from absolute
- Print url to default featured image
- Change add_filter based on Ajax
- What action/filter can be used for modifying the page to be rendered?
- Adding user filter – Not updating data in URL
- How to add more than one custom metadata as filter on the post list page?
- filter wptexturize doesn’t work on old posts titles
- wp_get_attachment_link filter not working
- Add Default WordPress Formatting To Data From External SQL Tables?
- Getting entry ID from frm_email_message filter in formidable
- Is there a hook or filter that adds a button to the left of the search box?
- filter a list by gender
- Filter a custom post type by custom field in admin
- Search and Filter Using Custom Post Type, Custom Taxonomy, and Advanced Custom Fields