Skip to content

Instantly share code, notes, and snippets.

@TeemuSuoranta
Created December 31, 2019 08:41
Show Gist options
  • Save TeemuSuoranta/4efa16178651f67db58bd228defb7dac to your computer and use it in GitHub Desktop.
Save TeemuSuoranta/4efa16178651f67db58bd228defb7dac to your computer and use it in GitHub Desktop.
Migrate from Enhanced Media Library to Filebird
wp plugin deactivate enhanced-media-library
wp plugin activate filebird
wp search-replace 'media_category' 'nt_wmc_folder'
for term_id in $(wp term list nt_wmc_folder --field=term_id)
do
wp term meta set $term_id folder_type default
wp term meta set $term_id folder_position 0
done
wp cache flush
wp transient delete --all
@TeemuSuoranta
Copy link
Author

Also, sync folders with all languages by adding:

/**
 * Filebird: Sync attachment's folder
 */
add_filter('pll_copy_taxonomies', function ($taxonomies, $sync) {

  $taxonomies[] = 'nt_wmc_folder';
  return $taxonomies;

}, 10, 2);

@TeemuSuoranta
Copy link
Author

For extra lazyness, here's the composer command to install the plugin
composer require wpackagist-plugin/filebird

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment