You have to add the metadata information with the new b&w thumbnail:
$meta['sizes']['thumbnail-bw'] = array(
'width' => $meta['width'],
'height' => $meta['height'],
'file' => $file
);
after generating the new image (after the switch block).
There ‘s also a plugin, called Grayscale, that does exactly what you need.
Related Posts:
- WordPress set featured image to first image of the post
- add_filter with specific thumb names
- Trouble understanding apply_filters()
- What is the very earliest action hook you can call?
- Removing Image and Caption Dimension Attributes
- Changing JPEG compression depending on image size
- Remove Editor From Homepage
- Advanced Custom Fields and Yoast SEO keyword analysis [closed]
- Is it possible to use object in add_action?
- Change WordPress image URLs via filter
- Remove title attribute from images
- Store source permalink on XMLRPC calls
- How to make post and comment count unclickable with dashboard_glance_items hook
- Hook into admin post list page
- Anyway to edit the titlebar of WordPress Widgets in the Admin area?
- Using hooks to place content in theme dynamically
- PHP5, Inheritance, Singleton – action & filter hook limitations
- Please explain me what the do_action does
- Apply the_title filter to post titles AND backend auto social-sharing plugin, but not nav menu
- Add ‘if exists’ to filter
- changing variable through filters or action hooks
- Apply a filter only once
- How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks
- How to get current action?
- Conditionally call add_action depending on post_type?
- how to change appearence of the content of default post list columns?
- Anonymous function is executed twice in wp_head while added from the_posts filter?
- Explanation for remove_filter used in the below code [closed]
- How to change the blog title with add_filter? details below
- How To Get User Data in Callback Function for pre_user_nicename?
- What’s the best way to split admin-only functionality in the theme’s functions.php file?
- When to use actions and when to use filters
- Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?
- Same Conditionals Not Working on Two Different Hooks
- How to call a function or method that is Namespaced using another plugin
- How to change currency programmatically on creating order action?
- Removing an action, or dequeueing style – Both not working
- How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
- Replace a word with a word in the URL string
- How to add ‘total’ value to custom column title on the posts list page
- How to removes all instances of thumbnails displayed in my theme?
- When to use add_action when registering/enqueuing scripts
- Insert term when page is published – avoid duplicates after edits
- Capture post content before page renders
- Is there any action/filter hook to use when an image gets edited in the editor?
- Shortcodes — Using add_action, add_filter in the shortcode
- Can the wordpress color palettes by changed through Javascript?
- How to properly modify WP Vary or any existing headers?
- How to pass variables to custom filter from multiple functions
- Building a request processor for multi-page forms, etc using $_GET requests
- How to customize the “Insert/edit link” popup box?
- How to get a single hook from wp_head()?
- How can I output all apply_filters and do_action?
- Override has_post_thumbnail function
- How to allow code block in wordpress comments
- Add a filter inside an action init
- Filter for post_thumbnail: link to small src and add data-attribute [duplicate]
- remove_action: how to access to a method in an child class?
- Is it possible to apply_filter on a wp_ajax_ action?
- Add a filter to an action [closed]
- How to disable thumbnail filter for a specific template part or image size?
- How can I specify the post status of an untrashed post?
- why require – does not load filter
- Most performant/functional way to add actions/filters?
- Remove tags without a specific meta key from “choose from the most used tags”
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Register new user, assign custom role then send email
- What is the action hook to use if you want to capture the new password during password change?
- How can I edit comment meta value before it is saved?
- Disable sanitize_file_name on upload without modifying functions.php
- Removing URL and adding container around image in the featured image metabox
- Redirect after post deleted
- What is the action or filter for adding information under the Permalink in Edit Post/Page?
- Making an add_filter() call from within an add_filter() call
- Plugin default settings hook
- How would I use a filter to remove header banner on certain post types
- Action hook to control access to certain parts of my site
- Finding actual functions added to hooks and filters
- output custom Posts on a Page
- Replace Data In Post & Update Meta Field Post Is Saved
- How to apply filter on get_the_post_thumbnail()
- add_action with associative array
- Does anybody know what the $current_screen ->id for customizer.php is?
- adding an action inside if condition not working
- Action for opening attachment or manipulating all attachment links
- Set post featured image to author image
- How to filter wp_get_recent_posts() to only posts that have thumbnails?
- Put data in my-account/view-order/id/ page
- Hook inside a hook
- List all image sizes still getting disabled sizes
- What problems could happen if I replaced add_filter and add_action with the function calling
- check, if any “add_action” function contains string XXXXXXXXX
- changing size image within the content
- Remove action added from class
- Adding to an array & passing it through do_action/apply_filters
- Is this correct usage of filters in WordPress [closed]
- How would I remove an inline googleAPI font script in the the parent theme header.php?
- GET form action. Redirect to self
- How to use add_filter to add the extra data to existing array?
- WP “optimizing” PNGs into thumbnails 5X larger than originals – FIX