ThemeFuse/Unyson-Backups-Extension

theme_mods name replace

spatricius opened this issue · 1 comments

Hi,

I'd like to update theme_mods_ option according to current theme location. Depending on where theme was installed by user, it can be:
/themes/my_theme/
/themes/theme/my_theme/
/themes/zip/my_theme/
etc.

I can see this is supposed to be done automatically in restore task, however at \FW_Ext_Backups_Task_Type_DB_Restore::do_import there is this line:

// prevent template overwrite stylesheet (prefer stylesheet)
$state['params']['template'] !== $state['params']['stylesheet']

which prevents this from happening. Actually, I think it should be == instead of !==. However, if this is for a reason, I would like to hook my own replacements. Currently I'm not able to use the hook below because of $filter_data being empty:

if ( ! empty($filter_data) ) { $replace_option_names = array_merge( /** @since 2.0.12 */ apply_filters('fw_ext_backups_db_restore_option_names_replace', array(), $filter_data), $replace_option_names ); }

Thanks!

It's not recommended installing the theme in sub-directories /themes/theme/my-theme, even wordpress do not handle theme properly, as during theme update it will add the updated version it in the themes root folder:

  • Original location: /themes/theme/my-theme
  • Updated location: /themes/my-theme