Created
August 27, 2021 17:05
-
-
Save hereswhatidid/bf6caac81fc300d1284a4b00d35f3253 to your computer and use it in GitHub Desktop.
Pass parameters to Regenerate Thumbnails plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Preselect the delete old and only missing checkboxes based on the `deleteold` query param | |
**/ | |
add_filter( 'regenerate_thumbnails_options_onlymissingthumbnails', function( $checked ) { | |
return ( empty( $_GET['deleteold'] ) && ( $_GET['deleteold'] !== 'yes' ) ); | |
}); | |
add_filter( 'regenerate_thumbnails_options_deleteoldthumbnails', function( $checked ) { | |
return ( ! empty( $_GET['deleteold'] ) && ( $_GET['deleteold'] === 'yes' ) ); | |
}); | |
/** | |
* URL structure for passing specific images: /wp-admin/tools.php?page=regenerate-thumbnails&ids=7033%2C7028%2C7027%2C7026 | |
**/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment