- ACF (and all ACF extensions) should be loaded from
functions.php
, before acf-recover. Do not try to use ACF as a plugin, otherwise this utility won't play nice. - Clone this repo on it's own folder, right into theme directory. The name is not important as long as it have it's own folder.
- Have your exported fields as
acf_export_recover.php
located one level upper than this script. - Edit
acf_export_recover.php
and replace all instances ofregister_field_group
withre_register_field_group
. - This utility assumes you have ACF 4.x. For ACF 5.x, please take a look at this utility
So basically you will have a structure like this:
ThemeDirectory
ThemeDirectory\functions.php
ThemeDirectory\acf_export_recover.php
ThemeDirectory\acf-recovery\*
- In your
functions.php
file include therecover.php
; - Access admin with
?recover-acf-fields=1
added in your URL; - Do not reload this page, otherwise you will have duplicates;
- Remove
recover.php
fromfunctions.php
; - Enjoy!
You can change default entry status (which is draft) and entry title suffix (which is (recover) ) by adding these two filters in your functions.php
file:
add_filter( 'acf/import/post_status', function(){ return "publish"; } );
add_filter( 'acf/import/title_suffix', function(){ return ""; } );
- ACF Recovery (works only with ACF 3)
- Lost many fields after import.