Given that that is a filter, it should be returning $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
- Is there a way to override only a portion of the function print_media_templates defined in wp-includes\media-template.php?
- Why is the change in my query not taking into account
- wp_mail works with add_action(‘save_post’, …) but not an ajax action
- add_filter with retrieve_password_message() not working in plugin, but works in functions.php
- Add a div of content within the_content after a certain block
- Gutenberg Block – Post Featured Image Filter Hook
- Is it possible to put the add-filter()-hook into a function?
- How can I return shortcode output to the top of the content?
- separate categories with comma and srounded by single quote
- Filter for when the post is updated
- Media Library Won’t Display Any Images
- Prevent add_filter being applied to wp-admin pages
- Translate custom order status through a filter?
- Filter a pluggable function
- apply_filters(‘get_the_content’, $content) + Except
- Filter everything from content except output of a shortcode
- Filter have_posts()/ the_post()
- More Fields & Media Upload
- Is there a way to globallly apply esc_html( … ) to all inputs and anchors to filter out XSS markup?
- How does wordpress handle media files?
- Change Image folder Locations
- Filter get_page_by_path()
- Handle multiple parameters in filter
- How to add filter in custom rss feed
- download button for audio file in post [closed]
- Want to use wp_get_current_user() in query filter
- Changing titles in Uploader for “Posts”
- Apply wordpress filter checking category
- How To Get Search Term and Use in Function
- alternative to the_content filter
- preg_match() not working with post content
- Search a title word through query_posts (not the exact match)
- Parse a shortcode differently based on on what it’s nested in
- Elementor Image Hover + Filter Grid [closed]
- How to redirect template_directory to subdomain relativ url?
- How do I add tags to entire comments, not just their text
- How to display a warning when an uploaded image is too small?
- Scanning for custom embed and prefetching
- How to exclude or include categories in wp rest API without query parameters?
- Remove and replace woocommerce add to cart button [closed]
- Can’t upload format files on media library
- Replace a specific URL on all apperances on the Website (Maybe a filter?)
- How Do I Change the File Permission For Uploaded Files in WordPress?
- Modify WordPress Page Title ()
- unsharp thumbnails after uploading image
- How to add lazy field in content endpoint using Gutenberg blocks
- Modify Contextual Help
- image not display in media library and thumbnail not display in post
- how to use apply filter for Class?
- Modify WordPress search behaviour in backend?
- Re-order search results with posts_orderby filter and post meta value
- Set Microsoft Word links to open in new window/tab
- Using Gravity Forms to upload media into library, then attach to post
- ‘the_content’ Filter delivers empty string with lengh (608)
- Testing requested query in pre_get_posts
- Output dynamic_sidebar_params in wp_head
- How to sort posts according to meta value?
- Modify WooCommerce email shipping text value
- Using Filters To Change Page Title
- remove_filter excerpt_more from a plugin class
- Broken Media Library
- How do you filter get_media_items by mime type in a custom media upload tab?
- Is it possible to dynamically change the “page_for_posts” option?
- How to override hook from themes functions.php which is defined in plugin