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?
- what is __return_false in filters
- How to get attachment id as soon as it is uploaded through media uploader in jquery?
- How to restrict images in v3.5 Media Library modal to only those from a specific post id?
- How to hide media uploads by other users in the Media menu?
- Custom theme hooks / filters – passing arguments
- How to hook wp_list_pages?
- How to hide CPT files from media library programmatically
- Don’t replace “|” with Empty String (“”) when generating slugs from title
- apply_filters(‘the_content’, $content) alternative
- Add metabox with media uploader in a custom post type [duplicate]
- How to use the_excerpt in a filter hook?
- Changing document title only on a custom page template
- Shortcodes not resolved in AJAX call response
- Add filter to wp_dropdown_pages() or wp_dropdown_categories() – no select container?
- How do I pass the value from a foreach loop to an add_filter function? [closed]
- Search results sorted by post types
- Filter or Hook to catch pre-rendering of post content
- check to see if hook is available
- Cannot upload .mp3 file to wordpress media
- Use add_filter on concatenated string variable
- Filter users by custom colum not meta key
- how to get URL of media uploaded to WordPress via media_handle_sideload()
- How to allow users to view pending posts of a specific custom post type?
- Remove filter callback: method in class
- How organize uploaded media in WP?
- How to filter meta_values using REST API
- Error uploading image in WordPress
- Admin Backend – Search Pages only by title
- Add content as soon starts
- Access get_the_title() from ‘excerpt_length’ filter
- Using wp_enqueue_media() with switch_to_blog() issue
- Wrong post_status notice after wp_insert_post_data
- Comment search plugin
- How to display the content HTML of a page without displaying the gallery code as well
- Images don’t update after being edited
- Remove Comment Author Link only for subscribers
- How to change the text of the “You are about to permanently delete these items…” alert message when deleting media from the media library?
- WooCommerce coupon hook argument NULL when using filter woocommerce_get_shop_coupon_data
- How can I edit comment meta value before it is saved?
- Why current_user_can(‘edit_comment’) always true?
- Redirect after post deleted
- Image not showing up in media loader success area – followup
- How do I add a line break to a string that is output by PHP?
- Distinguish between page and post in function
- How do I set a maximum upload size for a specific user role (Editor)
- Display posts from today and future in Elementor ‘posts widget’
- Right filter for rewriting page statuscode
- Changing title using filter not working with argument
- Archive Widget – Count only parent posts
- How to Protect Uploads, if User is not Logged In?
- Bulk upload images in upload folder does not show in media library
- adding an action inside if condition not working
- Adding filter to an specific page/site direction
- Cutting off excerpt with first sentence
- Change URLs in default WordPress slider to relative from absolute
- Uploads folder only showing files up to the letter “P”
- Change add_filter based on Ajax
- check, if any “add_action” function contains string XXXXXXXXX
- How to add more than one custom metadata as filter on the post list page?
- How to split my uploaded media into directories?
- Add Default WordPress Formatting To Data From External SQL Tables?
- Joining tables not working in the post editor page
- Auto append text after the title?
- add_filter(‘the_content’, ‘method’) does not trigger my custom method
- What does WordPress media uploader do to image files on upload?