Given that that is a filter, it should be return
ing $metadata
instead of returning nothing.
add_filter( 'wp_generate_attachment_metadata', 'mvt_save_photo_credit', 10, 2 );
function mvt_save_photo_credit( $metadata, $attachment_id ) {
add_post_meta($attachment_id, '_mvt_credit', $metadata['image_meta']['credit'], true);
return $metadata; // <-- giving back what we got
}
I was able to duplicate the issue you describe, and that small change fixed it.
This only matter for filters down line of this one, but with filters you should (nearly) always return information. You never know what will break if you don’t.
Related Posts:
- Upload restrictions – upload_mimes – filter: Adding multiple MIMEs for a single extension and adding multiple extensions for a single MIME type?
- Filter Media by attached page or blog post in Library
- How can I add an Author filter to the Media Library?
- Filter media library items by size
- Limit Media Library to Given Folder
- Change upload directory on custom plugin page
- WP Rest API – Upload media without saving attachment post
- Disable resizing of gif when uploaded
- Can I add custom meta for each image uploaded via media-upload.php?
- Ignore a filter on the media library
- Change text of Description in Image Library
- WordPress 3.5+ upload tool filter
- How to check if “media_send_to_editor” is audio?
- Ignore dots when searching in the media library?
- Pass parameter to the upload_dir filter
- Changing image URLs in media library
- Allow EPS file upload – two EPS files have different MIME types
- Move a file from a directory to another
- Filter Media by Featured on Admin
- How add a group by to the query used by the media library?
- 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
- Redirect to another page using contact form 7? [closed]
- Media upload default title from file name
- Possible to hook into Media Library preview File column and use a custom image?
- Create a pre-filtered version of the Media Library
- How to add custom media library mime icons?
- How to add HTML into error message
- Show uploaded pdf files dynamically and filter by month name
- Overriding Generated Attachment Post URL
- Code restricted to dashboard, running unexpectedly in the frontend (pre_get_post and admin-ajax.php)
- How to get to the date of the uploaded file
- Post Type Upload Directory – {post_type}_upload_dir filter
- This code works, but breaks the media uploader. How do I integrate it in a way that won’t?
- Changing upload directory temporarily
- Why wordpress doesn’t allow to add author filter to media library page in grid mode
- Is there a way to override only a portion of the function print_media_templates defined in wp-includes\media-template.php?
- Upload to a specific media folder created by FileBird Lite
- How do I restore attachment from files in wp-upload
- Passing value from one hook to another
- Deregister Custom the_title Filter for edit_post_link
- custom post filter based on Visitors country
- Many images in wp-content/uploads folder that are not in Media Library
- Filter a custom post type by custom field in admin
- How to correctly override a filter?
- Limit total tags in the_content
- Is there a way to check if the ‘wp_sitemaps_enabled’ is true or false?
- How to use filter in this situation, can not modify the structure using filter
- Load images from CDN and custom features to “Add Media” dialogue
- Block Gutenberg Editor manually by User Roles with a Filter with code
- Is it possible to dynamically change the “page_for_posts” option?
- What is the proper use of guid for images in wp_posts?
- Assign multiple categories to Media Library upload
- Change password reqts with NO plugin without breaking resetpass link?
- upload image to wordpress media library failed for custom post type
- Using the REST API filter, including two meta_queries breaks the response for one custom post type
- Image in binary in the data to WordPress media library
- How can I add custom sizes for PDF thumbnails generation?
- How can I conditionally add the filter option_home?
- Search and Filter Using Custom Post Type, Custom Taxonomy, and Advanced Custom Fields
- Adding filter to the Contact Form 7 response
- Remove rel=”ugc” from links in comments
- posts_results filter – additional sort, with a meta value, to move posts to the end of the results, with pagination working
- How to use parse_query() to add an additional filter based on content to page search?
- FacetWP was unable to auto-detect the post listing : Having an issue with ACF load choices causing FacetWP error
- How to change content hash value, within the_block_template_skip_link action?
- add_filter – create_function pb in PHP8
- Media manager asks for file title when upload
- How to apply_filter / add_filter within 2 others (simultaneous?) add_filter
- wp media uploader and ID3 tags
- How to Dynamically Switch WordPress Front Page Without Causing Canonical Redirect?
- Change or replace user_profile_picture_description filter, to stop stripping whitespace
- Woocommerce price filter widget always shows max price of most expensive product in the whole shop
- Simplifying ‘Add Media’ Modal in front-end Content Editor
- How to Upload a media item with alt text and description
- Trying WP editor to load full size image (not ‘300×300’)
- Cannot Upload Video (MP4) File
- “Media Library” shows as empty, despite images being present
- remove_function method removing next priority action too while removing current priority
- Are blocks that are converted to patterns no longer filterable through the_content?
- How to use add_filter to add the extra data to existing array?
- wc_get_template_part filter not working
- Different upload file size limits based on file type
- How to change media folder from created time of the post to publish date?
- hook on the_excerpt
- Deactivate code made with add_filter
- Does WordPress Super User or Administrators can create and edit post and media on behalf of a user
- ‘Problem’ with login_redirect filter – why does it lose the redirect_to parameter
- Adding multiple MIME types of the same extension to WordPress?
- WordPress Media Uploader not displaying image that has just been uploaded
- How could I create real-time filtering in this case?
- How to filter products by category in custom loop
- How to use render_block filter in Gutenberg when editing a page?
- WordPress REST API and Backbone JS
- Add URL in image upload error message
- “Invalid parameter(s): attributes” issue in context of “blocks.registerBlockType” filter
- How do I query Pending posts?
- Modify upload directory to use post category slug in file path on multisite installation
- I can’t see all images in my media library – How Can I reset the index of that library?