Skip to content

Instantly share code, notes, and snippets.

@Ataurr
Last active December 14, 2016 07:54
Show Gist options
  • Save Ataurr/9efce70a7492048649b41d9bffc9a69a to your computer and use it in GitHub Desktop.
Save Ataurr/9efce70a7492048649b41d9bffc9a69a to your computer and use it in GitHub Desktop.
https://github.com/ThemeFuse/Unyson-Backups-Extension/issues/30#issuecomment-253008320
This possibility was already there #15
How to disable image sizes remove on Content Backup
Important! Use this code only while developing, to export a demo install with image sizes included. Do not include this code in theme in production, because all Content Backups created by user will be with image sizes.
Add the filter in {theme}/functions.php
add_filter(
'fw:ext:backups:add-backup-task:image-sizes-remove',
'_filter_theme_fw_ext_backups_disable_image_sizes_remove',
10, 2
);
function _filter_theme_fw_ext_backups_disable_image_sizes_remove(
$do, FW_Ext_Backups_Task_Collection $collection
) {
$do = false;
return $do;
}
Do Content Backup
Remove the filter from 1.
How to disable image sizes restore for specific demo
add_filter(
'fw:ext:backups:add-restore-task:image-sizes-restore',
'_filter_theme_fw_backups_disable_image_sizes_restore'.
10, 2
);
function _filter_theme_fw_backups_disable_image_sizes_restore(
$do, FW_Ext_Backups_Task_Collection $collection
) {
if (
$collection->get_id() === 'demo-content-install'
&&
($task = $collection->get_task('demo:demo-download'))
&&
($task_args = $task->get_args())
&&
isset($task_args['demo_id'])
&&
in_array($task_args['demo_id'], array('DEMO_ID_1', 'DEMO_ID_2'))
) {
$do = false;
}
return $do;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment