Version 14 to 15
This migration guide contains migration instructions for:
- eightshift/libs - 10+ —> 11.0.0
Eightshift Libs
Section titled “Eightshift Libs”media.php file:
Section titled “media.php file:”before
/** * Register all the hooks * * @return void */public function register(): void{ ...
// WebP. if (\extension_loaded('gd')) { \add_filter('wp_generate_attachment_metadata', [$this, 'generateWebPMedia'], 10, 2); \add_filter('wp_update_attachment_metadata', [$this, 'generateWebPMedia'], 10, 2); \add_action('delete_attachment', [$this, 'deleteWebPMedia']); }}after
/** * Register all the hooks * * @return void */public function register(): void{ \add_action('after_setup_theme', [$this, 'addThemeSupport'], 20); \add_filter('upload_mimes', [$this, 'enableMimeTypes']); \add_filter('wp_prepare_attachment_for_js', [$this, 'enableSvgMediaLibraryPreview'], 10, 2); \add_filter('wp_handle_upload_prefilter', [$this, 'validateSvgOnUpload']); \add_filter('wp_check_filetype_and_ext', [$this, 'enableSvgUpload'], 10, 3); \add_filter('wp_check_filetype_and_ext', [$this, 'enableJsonUpload'], 10, 3);
// WebP. if (\extension_loaded('gd')) { \add_filter('wp_handle_upload', [$this, 'convertMediaToWebP']); }}Removed helpers
Section titled “Removed helpers”- There is no need to check if WebP is used anymore, as all allowed media are converted to WebP by default.
Helpers::isWebPMediaUsed();Helpers::getWebPMedia();Regenerate media
Section titled “Regenerate media”- If you already have generated WebP media with the old method:
You need to run the following command to regenerate the media: wp boilerplate run regenerate-media --only_update_db='true'. This will update the database with the new WebP media paths.
- If you haven’t generated WebP media with the old method:
You need to run the following command to generate the media: wp boilerplate run regenerate-media. This will generate the WebP media for all allowed media and update the database with the new WebP media paths.
- If you are using an S3 bucket for media:
If you are using an S3 bucket for media, and you have WebP media generated with the old method, just follow step 1. If you haven’t generated WebP media with the old method, you must have all media in the WP uploads folder and run step 2.