feat: add migration tool for ACF hidden layouts#12
feat: add migration tool for ACF hidden layouts#12arnespremberg wants to merge 1 commit intoflyntwp:masterfrom
Conversation
- Introduced a new migration script to transfer hidden layouts from the flyntwp/acf-hide-layout plugin to ACF's native "Deactivate layout" feature. - Added an admin page for the migration process, including options for a dry run and displaying results. - Updated the ACF_Hide_Layout class to include the migration script in the admin context.
|
A few more thoughts here:
|
|
@arnespremberg Thank you very much 🙏 We'll review and test it! |
|
Hi all, I just tested this on a multisite. Needs to be run on every site separately but works fine. |
|
@arnespremberg Thanks for showing your migration code. I have three things that should be known when using the migration code:
I am currently testing a DB-first approach: search all legacy keys *_acf_hide_layout directly in postmeta, termmeta, usermeta and options, aggregate the indices per context + field name and then write the native structure once via acf_update_metadata_by_field(...). Before that I tried to go via the registered field groups, determine all flexible_content fields (incl. nested) there and then search/migrate for *_acf_hide_layout only for these field names. The advantages would be to migrate only active fields, with the disadvantage to keep possibly orphaned meta entries (fields deleted). |
|
Hi @mjot thanks for the thorough review and feedback. I believe that especially the Options might be an issue. Since we don't use Flexible Content outside of regular post types I successfully migrated our client's websites using this tool. Given your concerns, I'd leave it to @steffenbew if he wants to implement this solution or a similar approach, or one of the others you described. |
This is an attempt to migrate from this plugin to ACF's native "Deactivate layout" feature.
The UI could be improved somewhat. I also did not test this on more than a single instance, especially not on a multisite. Will keep testing and keep updating. Happy to receive feedback!